Configuring NXLog Manager for Cluster Mode
It is possible to run multiple instances of NXLog Manager so that a group of agents connect to a specific Manager instance and all agents can be managed at the same time from either NXLog Manager instance no matter which one they are connected to. This mode is referred to as distributed mode or cluster mode.
The following needs to be set in the
/opt/nxlog-manager/conf/nxlog-manager.conf
configuration file on each
instance:
INSTANCE_MODE=distributed-manager
The NXLog Manager instances communicate over JMS (Java Message Service) API.
Please set the public IP address of the interface in
/opt/nxlog-manager/conf/jetty-env.xml
and make sure to replace the
value 127.0.0.1 set for JMSBrokerAddress with the public IP:
<Set name="jmsBrokerAddress">10.0.0.42</Set>
To operate in clustered mode, NXLog Manager requires MariaDB Galera Cluster v5.5.
Installing MariaDB Galera Cluster on Debian or Ubuntu
There is a very good installation guide here. The MariaDB Galera Cluster installation and configuration steps are summarized below.
Add the package repository:
# apt-get install python-software-properties
# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
For Debian Wheezy:
# add-apt-repository 'deb http://mirror3.layerjet.com/mariadb/repo/5.5/debian wheezy main'
For Ubuntu Precise:
# add-apt-repository 'deb http://mirror3.layerjet.com/mariadb/repo/5.5/ubuntu precise main'
Resynchronize the package index files:
# apt-get update
Install the packages:
# DEBIAN_FRONTEND=noninteractive apt-get install -y rsync galera mariadb-galera-server
Add the following to /etc/mysql/conf.d/galera.cnf
:
[mysqld] #mysql settings binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 query_cache_size=0 query_cache_type=0 bind-address=0.0.0.0 #galera settings wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_name="my_wsrep_cluster" wsrep_cluster_address="gcomm://<IP1>,<IP2>,...,<IPN>" wsrep_sst_method=rsync
Here IP1,…,IPN are the addresses of all nodes in the Galera cluster. Distribute this file to all nodes.
Start the Galera cluster.
First stop all nodes:
On node1:
# service mysql stop
On node2:
# service mysql stop
On nodeN:
# service mysql stop
Start the central node:
On node1:
# service mysql start --wsrep-new-cluster
Then start on all other nodes:
On node2:
# service mysql start
[ ok ] Starting MariaDB database server: mysqld . . . . . . . . . ..
[info] Checking for corrupt, not cleanly closed and upgrade needing tables..
On nodeN:
# service mysql start
[ ok ] Starting MariaDB database server: mysqld . . . . . . . . . ..
[info] Checking for corrupt, not cleanly closed and upgrade needing tables..
Verify all nodes are running:
# mysql -u root -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'
This command should return N, i.e. the number of cluster nodes.
Installing MariaDB Galera Cluster on RHEL
There is an installation guide here. The MariaDB Galera Cluster installation and configuration steps are summarized below.
To add the MariaDB repository create the file
/etc/yum.repos.d/mariadb.repo
with the following content:
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Now install MariaDB and Galera:
# yum install MariaDB-Galera-server MariaDB-client galera
You can download and install 'socat' here in case of the following error:
Error: Package: MariaDB-Galera-server-5.5.40-1.el6.x86_64 (mariadb)
Requires: socat
You could try using --skip-broken to work around the problem
To create an initial MariaDB configuration, execute these commands and follow the instructions:
# service mysql start
# mysql_secure_installation
# mysql -u root -p
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit
# service mysql stop
On each cluster node, edit /etc/my.cnf.d/server.cnf
and make sure to
add the following content:
[mysqld] pid-file = /var/lib/mysql/mysqld.pid port = 3306 [mariadb] query_cache_size=0 binlog_format=ROW default_storage_engine=innodb innodb_autoinc_lock_mode=2 wsrep_provider=/usr/lib64/galera/libgalera_smm.so wsrep_cluster_address=gcomm://IP2,...,IPN wsrep_cluster_name='cluster1' wsrep_node_address='IP1' wsrep_node_name='db1' wsrep_sst_method=rsync wsrep_sst_auth=root:password
Make sure to set the values appropriately on each node.
Start the cluster node using following command:
# /etc/init.d/mysql bootstrap
Bootstrapping the cluster.. Starting MySQL.... SUCCESS!
On the other nodes start, with the following command:
# service mysql start
Starting MySQL.... SUCCESS!
SELinux may block MariaDB from binding on the cluster port and it will
print the following error in the MariaDB error log in /etc/selinux/config
:
140805 7:56:00 [Note] WSREP: gcomm: bootstrapping new group '’cluster1’' 140805 7:56:00 [ERROR] WSREP: Permission denied 140805 7:56:00 [ERROR] WSREP: failed to open gcomm backend connection: 13: error while trying to listen 'tcp://0.0.0.0:4567?socket.non_blocking=1', asio error 'Permission denied': 13 (Permission denied)
This can be solved by running setenforce 0
and setting SELINUX=permissive
.
Then repeat the above installation steps on each node.