Installing The Galera-Iworx Cluster - Page 4

Want to support HowtoForge? Become a subscriber!
 
Submitted by DBezemer (Contact Author) (Forums) on Tue, 2013-06-25 19:33. ::

Now we are ready to install Interworx.

 

InterWorx-ControlPanel

Before installing stop haproxy & mysql & cmon on the nodes

service mysql stop && service cmon stop && service haproxy stop

Now we start moving around some file to restore the default MySQL environment (we have /var/lib/mysql on different disks, so if you dont, make a copy of the directories and restore these after installing interworx):

umount /var/lib/mysql
cp -r /tmp/interworx/var/lib/mysql /var/lib
chown -R mysql:mysql /var/lib/mysql
cp /tmp/interworx/etc/init.d/mysqld /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp /tmp/interworx/usr/libexec/mysqld /usr/libexec/mysqld
chmod 755 /usr/libexec/mysqld
mkdir /var/run/mysqld
chown mysql:mysql /var/run/mysqld
mv /usr/bin/mysqld_safe /usr/bin/mysqld_safe.galera
cp /tmp/interworx/usr/bin/mysqld_safe /usr/bin/mysqld_safe
chmod 755 /usr/bin/mysqld_safe
mv /etc/my.cnf /etc/galera.cnf
cp /tmp/interworx/etc/my.cnf /etc/my.cnf
mv /etc/init.d/mysql /etc/init.d/mysql.org

Edit the file

nano /etc/my.cnf

[mysqld]
old-passwords=1

Since Interworx and Galera remove and install lots of packages, we have to take some precautions.  Default it isn’t possible to combine those to packages. The steps before (create a backup set of the default mysql) can resolve this problem.

We first have to download the installer file and modify it:

cd /usr/local/src && wget -q http://updates.interworx.com/iworx/scripts/iworx-cp-install.sh

Now we have to comment out line 321, to prevent Interworx to mess up the mysql install.

nano iworx-cp-install.sh

# mysqlinstall

Then we can save the file and start the installer.

sh ./iworx-cp-install.sh

Press <enter> to begin the install...

After a while, you will get:

-=-=-=-=-= ALL DONE! THANK YOU! FOR USING InterWorx-CP =-=-=-=-=-

It’s good to check after installation the logs at  /home/interworx/var/log/error.log.
If ok, you’ll want to activate your InterWorx CP License.

Register now Interworx by using the website, since the command line doesn’t seem to work properly. Go to the website http://public IP Address:2080/nodeworx and enter the registration information:

After a while , you will probably get a blank page. To verify that the setup was completed you could test it with the command line method.

 

Scripted Activation Procedure

Run the goiworx.pex script with the following parameters (replace the bold text with the licensekeys below):
# Note: Make sure  the below is all one line. Replace LICENSE_KEY, EMAIL, and PASSWORD
 #~iworx/bin/goiworx.pex  --key=INTERWORX_YOURKEY --email=your@email.com --password=pw4yourIworx --ignorechecks

Now go to the website http://public IP Address/nodeworx and enter your login credentials. Accept the license agreement (some time you have to do this twice). If logged on you will be redirected to the page to configure your DNS servers:

Enter the requested primary/secondary DNS servers and click on update.  Click on System Services on the left side, followed by MySQL Server and Overview. Here we want to configure our Galera MySQL root password.

Click save again, logout and empty the IE cache incl. cookies etc.

If you have external nameservers, restore the original /etc/resolv.conf

echo "nameserver mynameserverip1" > /etc/resolv.conf
echo "nameserver mynameserverip2" >> /etc/resolv.conf

We now have configured the basic part of Interworx, ready to move those accounts into the Galera environment.   Repeat these steps for the other servers.

Ok, we now should be able to connect to the page http://Public IP Address Master/nodeworx and logon to interworx.  Of course we also have to logon to the slave servers later on.

After logging in to Interworx on the master server we want to configure the slave nodes:

Click on the setup button underneath Interworx-CP Cluster Manager.

Choose the Quorum IP Address (HeartBeat LAN), and click setup. We now going to add the slave nodes.

Since we need a API-Key of each slave server we logon tot the slave servers, click on Nodeworx in the left menu, click on API-key and then on Generate on the right side panel.

After you click on generate you will see an API-key being generated.

Copy this key and go back to the master server.

Add the slave by using their IP-Address since the Heartbeat node isn’t separate available in the DNS.  Past the API-key, run test first, and then add the API-key. If all of this is working, and cmon also is green we are ready to go further. We start with rolling back the MySQL environment to the Galera environment. First stop on all servers the services!

service iworx stop && service mysqld stop

Now we rollback the Galera MySQL environment (on all servers). Again: we use separate disks for mysql, if you dont use the copies you made before.

mv /etc/my.cnf /etc/interworx.cnf
mv /etc/galera.cnf /etc/my.cnf
mv /usr/bin/mysqld_safe /usr/bin/mysqld_safe.interworx
mv /usr/bin/mysqld_safe.galera /usr/bin/mysqld_safe
rm -rf /var/run/mysqld
rm -rf /usr/libexec/mysqld
rm -rf /etc/init.d/mysqld
mv /var/lib/mysql /var/lib/mysql.iworx
mkdir /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql/
mount -a
mv /etc/init.d/mysql.org /etc/init.d/mysql

Now start on all servers the services:

service mysql start && service cmon start && service iworx start && service haproxy start

Wait until cmon recovers again!

It is possible that MySQL want start the first time stop and start it until it works normal. There could be a lost pid file or subsys file, that you have to remove first. Anyway if it works normal we can remove some extra files

rm -rf /var/lib/mysql.iworx /usr/bin/mysqld_safe.interworx /tmp/interworx

If al servers are done, we have to insert the Iworx users into the Galera MSQL databases. On the master server and galera cluster we run the following mysql statements:
These values are available from Interworx if you install without the modified installer.

mysql --user=root  --password=pw4mydatabase
INSERT INTO  `mysql`.`user` VALUES ('localhost','iworx','[your iworx password in old password format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL),
('127.0.0.1','iworx','[your iworx password in old password  format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL),
('172.20.0.2','iworx','[your iworx password in old password  format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL),
('172.20.0.3','iworx','[your iworx password in old password  format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL),
('172.20.0.4','iworx','[your iworx password in old password  format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL),
('172.20.0.1','iworx','[your iworx master password in old password  format]','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'',NULL);
GRANT ALL ON *.* TO  'iworx'@'172.20.0.1' IDENTIFIED BY ‘pw4mydatabase’;
FLUSH PRIVILEGES;
exit

Wait until its up and running and in sync on the webpage http://master IP Address/cmon (use FireFox since this one updated the page better than IE).

Let’s start Iworx again:

service iworx start


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.