How to connect two ASTPP server to the same database
By Yevgeniya Suminova on 2021-06-15
Updated by Elen Virabyan on 2021-09-09
Contents
Connecting ASTPP2 to the DB of ASTPP1 and the opposite
The aim of this task is to be able to separate the Database server from Freeswitch server. This will allow to perform large operations with the DB such as, importing and exporting rates and tariffs without overloading the server that handles all calls.
1. We should already have two ASTPP servers installed by following these instructions: https://docs.switzernet.com/3/public/210311-astpp-instalation/
2. Knowledge how to login via ssh to the server
At this point, we need to connect ASTPP1 to the DB of ASTPP2
and the opposite.
Connect
to ASTPP1 and add the IP of ASTPP2.
sudo su
firewall-cmd --zone=trusted --add-source=IP of ASTPP2
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
Connect to ASTPP2 and add the IP of ASTPP1.
sudo su
firewall-cmd --zone=trusted --add-source=IP of ASTPP1
firewall-cmd --runtime-to-permanent
firewall-cmd --reload
* Change the IP’s marked yellow correspondingly.
On ASTPP1 change the authorized host for astppuser:
mysql -u root -p
use mysql;
update user SET host = ‘%’ where user = ‘astppuser’;
Give privileges to the astppuser:
GRANT ALL PRIVILEGES ON *.* TO 'astppuser'@'%' WITH GRANT OPTION;
Giving privileges can vary depending on mysql version.
If the command above gives an error try this one:
GRANT ALL PRIVILEGES ON *.* TO
'astppuser'@'%';
FLUSH PRIVILEGES;
Then check ability to connect from ASTPP2 to ASTPP1 mysql
client by astppuser.
Connect to ASTPP2 and run the command:
mysql -u astppuser -h ASTPP1ipaddress -p
Note: The password for mysql user ‘astppuser’ for ASTPP1 needs to be used.
On ASTPP2 we will now need to modify some files:
nano /var/lib/astpp/astpp-config.conf
Change dbhost and dbpass to the data from ASTPP1
Save the file as follows: Ctrl+x => Y => Hit Enter
Then do the same change as above in another file “/var/lib/astpp/astpp.lua”
nano /var/lib/astpp/astpp.lua
Save the file as follows: Ctrl+x => Y => Hit Enter
Then make changes in the following three files:
nano /etc/odbc.ini
nano /opt/ASTPP/misc/odbc/cent_odbc.ini
nano /opt/ASTPP/misc/odbc/deb_odbc.ini
Where you see password as <PASSWORD> - keep it as it is.
You are done.
Now go to the web GUI of both ASTPPs and do some changes like creating new accounts. You will see that when you’ve created an account on ASTPP1, you will see the same data on ASTPP2 and vice versa. This is because they are both now connected to the DB of ASTPP1.
When ASTPP2 is connected to the DB of ASTPP1, it is not possible to see “Registered SIP Devices” and “Registered Gateways” on ASTPP2. It is also not possible to see customer registered on ASTPP2 from ASTPP1.
To resolve this problem, it is most probably necessary to add a new SIP profile and/or add another Freeswitch server.
To understand how to add new SIP profile (what has to be done on both servers?)
To understand how to add a Freeswitch (what has to be done on both servers?
https://docs.switzernet.com/3/public/210311-astpp-instalation/
***
© 4z.com