1.配置主从同步
主服务器:建立从服务器的复制权限账号
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO 'repluser'@'192.168.8.45' IDENTIFIED BY 'replpass';
FLUSH PRIVILEGES;
show master status;
从服务器:
CHANGE MASTER TO MASTER_HOST='192.168.8.40',MASTER_USER='repluser',MASTER_PASSWORD='replpass',MASTER_LOG_FILE='mysql-bin.000008',MASTER_LOG_POS=107;
start slave
在两个mysql服务中分别建立一个用户名为cacti密码也为cacti的用户,用来给cacti服务器获取状态信息
grant process,super,replication client on *.* to "cacti"@"192.168.8.39" identified by "cacti";
FLUSH PRIVILEGES;
2.修改对应cacti上的php脚本链接数据库文件
vim /var/www/html/cacti/scripts/ss_get_mysql_stats.php