6.4 Create A Database Called ldirector
Next we create the ldirector database on our MySQL cluster nodes sql1.example.com and sql2.example.com. This database will be used by our load balancers to check the availability of the MySQL cluster nodes.
sql1.example.com:
mysql -u root -p
GRANT ALL ON ldirectordb.* TO 'ldirector'@'%' IDENTIFIED BY 'ldirectorpassword';
FLUSH PRIVILEGES;
CREATE DATABASE ldirectordb;
USE ldirectordb;
CREATE TABLE connectioncheck (i INT) ENGINE=NDBCLUSTER;
INSERT INTO connectioncheck () VALUES (1);
quit;
sql2.example.com:
mysql -u root -p
GRANT ALL ON ldirectordb.* TO 'ldirector'@'%' IDENTIFIED BY 'ldirectorpassword';
FLUSH PRIVILEGES;
CREATE DATABASE ldirectordb;
quit;
6.5 Prepare The MySQL Cluster Nodes For Load Balancing
Finally we must configure our MySQL cluster nodes sql1.example.com and sql2.example.com to accept requests on the virtual IP address 192.168.0.105.
sql1.example.com / sql2.example.com:
apt-get install iproute
Add the following to /etc/sysctl.conf:
sql1.example.com / sql2.example.com:
vi /etc/sysctl.conf
# Enable configuration of arp_ignore option |
sysctl -p
Add this section for the virtual IP address to /etc/network/interfaces:
sql1.example.com / sql2.example.com:
vi /etc/network/interfaces
auto lo:0 |
ifup lo:0
本文指导如何创建名为ldirector的数据库以供负载均衡器检查MySQL集群节点可用性,并配置集群节点接受虚拟IP地址请求。
106

被折叠的 条评论
为什么被折叠?



