Managing Multiple KVM Hosts With Enomalism2 [Ubuntu 8.10]

Version 1.0
Author: Falko Timme

In my previous guide about how to set up Enomalism2 on Ubuntu 8.10 I concentrated on just one KVM host. This tutorial is an extension to that article in that it shows how to add further Ubuntu 8.10 KVM hosts to the setup that can then be managed from one single control panel.

I have tested this with two Ubuntu 8.10 hosts (both x86_64). I can't say anything whether this also works on i386 systems because I haven't tested it.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I'm using two Ubuntu 8.10 servers here as my KVM hosts:

  • server1.example.com: IP address 192.168.0.100
  • server2.example.com: IP address 192.168.0.101

The servers are located in a private network with a DHCP server (on the router, IP 192.168.0.1). Enomalism usage might be different if you use it in a public network.

I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:

sudo su

Please check if your CPU supports hardware virtualization - if this is the case, the command

egrep '(vmx|svm)' --color=always /proc/cpuinfo

should display something, e.g. like this:

root@server1:~# egrep '(vmx|svm)' --color=always /proc/cpuinfo
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
 fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
 fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch
root@server1:~#

If nothing is displayed, then your processor doesn't support hardware virtualization, and you must stop here.

server1 will be the "master" in this setup and server2 the "slave", i.e., server2 will use the MySQL database on server1 and the directory /opt/enomalism2/repo (via NFS). (Of course, it's also possible to create a dedicated NFS server and export /opt/enomalism2/repo to both nodes.)

 

2 Setup On server1

server1:

server1 must be set up according to page 1 of this tutorial: KVM Virtualization With Enomalism 2 On An Ubuntu 8.10 Server

After you've set up Enomalism2, we must edit /etc/mysql/my.cnf so that MySQL listens on all interfaces (so that server2 can connect to this MySQL server later on) - comment out the line bind-address = 127.0.0.1:

vi /etc/mysql/my.cnf
[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address
[...]

Then we restart MySQL:

/etc/init.d/mysql restart

Now check that networking is enabled. Run

netstat -tap | grep mysql

The output should look like this:

root@server1:~# netstat -tap | grep mysql
tcp        0      0 *:mysql                 *:*                     LISTEN      6724/mysqld
root@server1:~#

Then we connect to MySQL...

mysql -u root -p

... and create a database user that is allowed to connect to the enomalism2 database remotely (use the same database user and password that you used in the scripts/init-db.sh step when you set up Enomalism2):

grant all on enomalism2.* to enomalism@'%' identified by 'enomalismpassword';
FLUSH PRIVILEGES;
quit

To install an NFS server, we run:

aptitude install nfs-kernel-server nfs-common portmap

We must export the /opt/enomalism2/repo directory. We must modify /etc/exports where we "export" our NFS shares. We specify /opt/enomalism2/repo as NFS share and tell NFS to make accesses to /opt/enomalism2/repo as root (to learn more about /etc/exports, its format and available options, take a look at

man 5 exports

)

vi /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/opt/enomalism2/repo        192.168.0.101(rw,sync,no_root_squash,no_subtree_check)

(The no_root_squash option makes that /opt/enomalism2/repo will be accessed as root.)

Whenever we modify /etc/exports, we must run

exportfs -a

afterwards to make the changes effective.

Share this page:

0 Comment(s)