Cacti Beginner's Guide(Second Edition)
上QQ阅读APP看书,第一时间看更新

Have a go hero - remote server for database hosting

Here is a little challenge for you. It's not difficult, but it will allow you to alter the installation to suit your needs. What if you want to use a remote database server? Maybe you want to use an existing, dedicated MySQL server instead of hosting the database on the same system as Cacti, or you want to separate the roles to allow more growth. Can you figure out what to change?

Solution: Create the MySQL database on the remote system using the same command as if installed locally but this time use the -h <hostname> option to specify the remote server. When creating the user and granting it permissions, use the following command, assuming the Cacti server has the IP, 192.168.0.10:

GRANT ALL ON cacti.* TO cactiuser@'192.168.0.10' IDENTIFIED BY 'MyV3ryStr0ngPassword'; 
flush privileges; 
exit 

This will allow the Cacti user access to the database from the Cacti server. Now change $database_hostname in config.php and DB_Host in spine.conf on the Cacti server to point to your remote database server. On the database server, you will also have to allow traffic to the 3306 database port using the following firewall commands:

    firewall-cmd --permanent --zone=public --add-port=3306/tcp
    firewall-cmd --reload