Installing The Galera-Iworx Cluster - Page 3

Now run the installer:

./deploy.sh  2>&1  | tee cc.log

First the setup will try to ping all nodes. If ok, setup will start, since we disabled SELinux and Configured the SSH keys we can answer the following:

do you want to set SELinux to Permissive mode. n
Can you SSH from this host to all other hosts without password? y

After successfully configuring the Galera cluster, there should be a ClusterMonitor (cmon) page where you can connect to on the master node at:

http://192.168.120.1/cmon

 

JPGraph

Some pages require JPGraph, install this on the master:

cd /usr/local/src
wget http://jpgraph.net/download/download.php?p=5
mv download.php\?p\=5 jpgraph.tar.gz
tar xvfz jpgraph.tar.gz -C /var/www/html/cmon
cd /var/www/html/cmon
ln -s jpgraph-3.5.0b1 jpgraph
chown apache:apache -R jpgraph*

 

Change MySQL.cnf (configure UTF-8 etc.)

Since we want to use the UTF-8 character set in our database we add this option to the [MYSQLD] section of the file:

#Add some interworx  settings
 #symbolic-links=0
# define default  character sets
   collation-server = utf8_unicode_ci
   init-connect='SET NAMES utf8'
   character-set-server  = utf8
#log
   slow_query_log  = 1
   slow-query-log-file=slow-queries.log
   long_query_time  = 10
#OTHER THINGS,  BUFFERS ETC
   myisam-sort-buffer-size  = 8M
   skip-name-resolve
   memlock=0
   event_scheduler=1

Furthermore we change the environment variables to UTF8:

echo "LANG=en_US.utf-8" >> /etc/environment
echo "LC_ALL=en_US.utf-8" >> /etc/environment

Now we can restart MySQL to make this setting active for the databases that will be created in the future.

service mysql restart

Now we have to correct some installer files. Since mysql-libs is removed by the Galera setup. We have to use the --excludepath option to get around the following error:

file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.5.28_wsrep_23.7-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.67-1.el6_3.x86_64

Download the mysql-libs rpm file and run it with the --excludepath option (which isn't available when using yum ):

cd /usr/local/src
wget ftp://mirror.switch.ch/pool/1/mirror/scientificlinux/6rolling/x86_64/os/Packages/mysql-libs-5.1.67-1.el6_3.x86_64.rpm
rpm -Uvh mysql-libs-5.1.67-1.el6_3.x86_64.rpm --excludepath=/usr/share/mysql/

Reinstall the packages that where removed because of the mysql-libs dependencies.

yum -y install nagios-plugins-all perl-DBD-MySQL innotop mytop

 

HAProxy setup

Next step is installing the HAProxy setup that uses cmon of the Galera cluster, to show its status information. At the master server we have to run the following commands:

# the installer needs to be extracted inside the galera installation folder!!!
cd /usr/local/src/s9s-galera-2.2.0-rpm/mysql/scripts/install
wget http://severalnines.com/downloads/s9s-haproxy.tar.gz
tar zxvf s9s-haproxy.tar.gz
cd haproxy

Before installing lets change some settings inside the following files:

install-haproxy.sh:           HAPROXY_MYSQL_LISTEN_PORT="3306"
makecfg.sh:                  "\tserver ${SPLIT[0]}  ${SPLIT[0]}:3333 check $STAT"
mysqlchk.sh.galera           MYSQL_PORT="3333"
mysqlchk.sh.mysqlcluster     MYSQL_PORT="3333"

Now run the installer:

./install-haproxy.sh 172.20.0.1 rhel galera

When the setup is completed without errors you have to grant the installer host rights to mysql instances on each server.

mysql -uroot -ppw4mydatabase
GRANT ALL ON *.* TO 'root'@'172.20.0.1' IDENTIFIED BY 'pw4mydatabase';
FLUSH PRIVILEGES;
exit

There is something what probably will go wrong tho, which is related to the defaults requiretty setting. It is possible that you get an error message like:

Pseudo-terminal will not be allocated because stdin is not a terminal.
sudo: sorry, you must have a tty to run sudo stdin is not a terminal.

If this happens edit the sudoers file (on all servers) by using:

visudo

and change the line

 Defaults    requirettys

into

#Defaults    requirettys

Now it should be possible to connect to the loadbalanced cluster on the following address:

mysql -h192.168.120.1 -P3306 -uroot -ppw4mydatabase

Check this from the slave nodes to make sure.

You can connect to the status page of the HAProxy, http://192.168.120.1:9600
(default admin/admin). You can change the username/password by editing the file:

nano /etc/haproxy/haproxy.cfg
userlist STATSUSERS
group admin users admin
user admin insecure-password pw4adminHA
user stats insecure-password pw4userHA
Share this page:

0 Comment(s)