2.3.1.2.1. ON Core principal primary
Note
ON Principal with primary role is only configured in architectures with one or more workers. This can be found in HA architectures.
The following steps explain the process that should be followed in order to configure a principal node.
Before executing any configuration, we must stop the following services:
systemctl stop opennac
systemctl stop gearmand
systemctl stop httpd
systemctl stop radiusd
Note
Remember to perform the Basic Configuration before proceeding.
Edit the /etc/my.cnf file and uncomment the “Replication (Principal)” section, make sure the server-id is 1.
vim /etc/my.cnf

Restart mysql service.
systemctl restart mysqld
Access mysql.
mysql -u root -p<mysql_root_password> opennac

Grant permissions to the different workers, execute the following command for each worker and use its IP address.
GRANT REPLICATION SLAVE ON *.* TO 'onworker'@'<worker_ip>' IDENTIFIED BY '<password>';

Note
Remember that it is important that this password is unique and that it should be stored somewhere safe, like a password vault.
This password will be used to configure all workers.
Grant privileges
GRANT ALL PRIVILEGES ON opennac.* TO 'admin'@'<worker_ip>' identified by '<admin_password>';

Note
Run for each worker with its own IP address.
The admin_password will be the same that is stored in the file ‘/usr/share/opennac/api/application/configs/application.ini’, from each worker, is the value of the field ‘resources.multidb.dbW.password’.

Flush privileges
flush privileges;

Still inside mysql, check the master status, mind the file and position for later use. After that exit from Mysql.
show master status;
exit

Note
Remember that the file and position values will be used in the Worker configuration.
Generate a dump of OpenNAC Enterprise database.
mysqldump -u root -p<mysql_root_password> opennac > opennac.sql
Insert the firewall rule into the master’s iptables.
vim /etc/sysconfig/iptables
Add the following line (where the worker_ip is the ip of the core that contains the replicated database).
-A INPUT -s <worker_ip> -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

Note
You need to configure a rule for each worker device with its own IP address.
Restart iptables service
systemctl restart iptables
Now, send this dump to all the workers (where the worker_ip is the ip of the core that contains the replicated database).
scp opennac.sql root@<worker_ip>: