Master MySQL server

From ISPWiki

Jump to: navigation, search

Prerequisite

If the second network interface is not present on the current server, jump this step.

Open /etc/network/interfaces

 # nano /etc/network/interfaces

to add the following lines

 auto ethX
 iface ethX inet static
     address 10.0.0.4
     netmask 255.0.0.0

where X is the network interface number.

Run the command below to apply the changes:

 # /etc/init.d/networking restart

Installing and configuring the MySQL server

Run the command below to install the MySQL server:

 # apt-get install mysql-server

Open /etc/mysql/my.cfg

 # nano /etc/mysql/my.cfg

and edit the options in the mysqld section as follows:

 ...
 [mysqld]
 bind-address 0.0.0.0
 log-bin mysql-bin.log
 expire_logs_days 10
 max_binlog_size 100
 server-id 1
 ...

Restart the MySQL server with the command:

 # /etc/init.d/mysql restart

Set the root password:

 # echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'XXX' WITH GRANT OPTION; \
   UPDATE mysql.user SET Password = PASSWORD('XXX') WHERE User = 'root'; FLUSH PRIVILEGES;" | mysql -uroot

where XXX is a root password.

Create a user for replications:

 # echo "GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%' IDENTIFIED BY 'XXX'; FLUSH PRIVILEGES;" | mysql -uroot -pYYY

where XXX is a user password for replications and YYY is a root password.

Register the MySQL server in ISPmanager Cluster with the following commands:

 # ssh root@10.0.0.6 "/usr/local/ispmgr/sbin/mgrctl -m ispmgr dbconf.edit name=MySQL dbtype=mysql \
   contype=remote addr=10.0.0.4 user=root passwd=XXX codepage=utf8 atype=allow sok=ok"
 # ssh root@10.0.0.6 "/usr/local/ispmgr/sbin/mgrctl -m ispmgr exit"

where XXX is a root password, 10.0.0.6 is the master node IP-address.

Was this helpful? Yes | No
Personal tools