Excerpt |
---|
Use external realtime DB on different server |
Table of Contents |
---|
Scaling Architecture
Configure the Asterisk Realtime Architecture
Note | ||
---|---|---|
| ||
After the configuration changes, please reboot the machine. |
GUI
You have to edit:
- the file called database.php, under the directory /var/www/html/application/config, as follows:
Code Block |
---|
$db['default']['hostname'] = 'DESTINATION_HOSTNAME_MYSQL'; $db['default']['username'] = 'DESTINATION_USERNAME_MYSQL'; $db['default']['password'] = 'DESTINATION_PASSWORD_MYSQL'; $db['default']['database'] = 'DESTINATION_DATABASE_MYSQL'; |
- the file called mysql.json, under the directory /var/www/html, as follows:
Code Block |
---|
{ "host": "DESTINATION_HOSTNAME_MYSQL", "port": "3306", "user": "DESTINATION_USERNAME_MYSQL", "password": "DESTINATION_PASSWORD_MYSQL", "database": "DESTINATION_DATABASE_MYSQL" } |
ASTERISK CDR
You have to edit the file called cdr_mysql.conf, under the directory /etc/asterisk/, as follows:
Code Block |
---|
hostname=DESTINATION_HOSTNAME_MYSQL dbname=DESTINATION_DATABASE_MYSQL password=DESTINATION_PASSWORD_MYSQL user=DESTINATION_USERNAME_MYSQL |
ASTERISK REALTIME
You have to edit:
- the file called res_config_mysql.conf under the directory /etc/asterisk/
Code Block |
---|
dbhost = DESTINATION_HOSTNAME_MYSQL dbname = DESTINATION_DATABASE_MYSQL dbuser = DESTINATION_USERNAME_MYSQL dbpass = DESTINATION_PASSWORD_MYSQL - the file called odbc.ini under the directory /etc/odbc.ini Server = DESTINATION_HOSTNAME_MYSQL User = DESTINATION_USERNAME_MYSQL Pass = DESTINATION_PASSWORD_MYSQL Database = DESTINATION_DATABASE_MYSQL |
PHONEBAR
You have to edit:
- the file called res_top.conf under the directory /etc/asterisk
Code Block |
---|
hostname = DESTINATION_HOSTNAME_MYSQL schema = DESTINATION_DATABASE_MYSQL user = DESTINATION_USERNAME_MYSQL secret =DESTINATION_PASSWORD_MYSQL |
- the file called res_xcalld.conf under the directory /etc/asterisk
Code Block |
---|
[mysql] hostname = DESTINATION_HOSTNAME_MYSQL schema = DESTINATION_DATABASE_MYSQL user = DESTINATION_USERNAME_MYSQL secret =DESTINATION_PASSWORD_MYSQL |
AGISQUARE
You have to edit the file called agisquare.conf under the directory /var/www/html/agisquare/etc
Code Block |
---|
[database] host = DESTINATION_HOSTNAME_MYSQL database = DESTINATION_DATABASE_MYSQL user = DESTINATION_USERNAME_MYSQL password =DESTINATION_PASSWORD_MYSQL |
Move the database
Note | ||
---|---|---|
| ||
The firewall, in the destination server, must permit the connection on the MySQL port (default 3306) |
- Create, on the destination server (DESTINATION_HOSTNAME_MYSQL), the xcally database and the user DESTINATION_USERNAME_MYSQL/DESTINATION_PASSWORD_MYSQL
- Connect to MySQL and launch the following queries:
Code Block | ||
---|---|---|
| ||
CREATE DATABASE IF NOT EXISTS DESTINATION_DATABASE_MYSQL; GRANT ALL PRIVILEGES ON DESTINATION_DATABASE_MYSQL.* TO 'DESTINATION_USERNAME_MYSQL'@'localhost' IDENTIFIED BY 'DESTINATION_PASSWORD_MYSQL'; GRANT ALL PRIVILEGES ON DESTINATION_DATABASE_MYSQL.* TO 'DESTINATION_USERNAME_MYSQL'@'%' IDENTIFIED BY 'DESTINATION_PASSWORD_MYSQL'; GRANT SUPER ON *.* TO 'DESTINATION_USERNAME_MYSQL'@'localhost'; GRANT FILE ON *.* TO 'DESTINATION_USERNAME_MYSQL'@'localhost' identified by 'DESTINATION_PASSWORD_MYSQL'; GRANT FILE ON *.* TO 'DESTINATION_USERNAME_MYSQL'@'%' identified by 'DESTINATION_PASSWORD_MYSQL'; FLUSH PRIVILEGES; |
- Go, on the original server, under /usr/src
cd /usr/src
- Launch the following commands:
Code Block |
---|
mysqldump -u root -ppwd --routines xcally > xcally-dump.sql mysql -u DESTINATION_USERNAME_MYSQL -pDESTINATION_PASSWORD_MYSQL -h DESTINATION_HOSTNAME_MYSQL DESTINATION_DATABASE_MYSQL < xcally-dump.sql |
In case your database username is different from the default one 'xcall', insert these commands instead of the last ones:
Code Block |
---|
mysqldump -u root -ppwd --routines xcally | sed -e 's/DEFINER=`xcall`@`%`/DEFINER=`DESTINATION_USERNAME_MYSQL`@`%`/' > xcally-dump.sql> xcally-dump.sql mysql -u DESTINATION_USERNAME_MYSQL -pDESTINATION_PASSWORD_MYSQL -h DESTINATION_HOSTNAME_MYSQL DESTINATION_DATABASE_MYSQL < xcally-dump.sql |
...