Current time: 05-05-2024, 10:09 PM Hello There, Guest! (LoginRegister)


Post Reply 
Real HA cluster implementation
Author Message
alexskynet Offline
Newbie
*

Posts: 9
Joined: Apr 2010
Reputation: 0
Post: #11
RE: Real HA cluster implementation
Hi everyone

I've my cluster up and running in HA mode.

Actually it works in active/passive configuration, but i plan to have it soon working with active/active load balanced conf.

I'm using heartbeat to have the things done and a NAS to hold all the share points I need (it may be done using DRBD too)

The main goal was to have users in sync in the two members, so I've setup nsslib-mysql to have users from ISPCP stored in the database.

It works very nice.

All the changes I needed to apply were in ispcp_common_methods.pl to have the users stored in the database if I activate the NSS patch in ispcp.conf.

It has been as simple as adding very few lines and a couple of queries.

I'll now focus on a ISNATTED configuration, where a number of servers (and the DNS) will be behind load balancers.

The only important thing will be to have only one ispcp daemon running at a time to ensure correct operation.

Here is a very litte howto about setting up and running the nss patch (I am on fedora 12 so adjust your package manager commands - all commands are as root):
a) yum install nsslib-mysql
Now create the required tables: log in in your mysql and type the following:
use ispcp;
CREATE TABLE groups (
name varchar(16) NOT NULL default '',
password varchar(34) NOT NULL default 'x',
gid int(11) NOT NULL auto_increment,
PRIMARY KEY (gid)
) TYPE=MyISAM AUTO_INCREMENT=5000;
CREATE TABLE users (
username varchar(16) NOT NULL default '',
uid int(11) NOT NULL auto_increment,
gid int(11) NOT NULL default '5000',
gecos varchar(128) NOT NULL default '',
homedir varchar(255) NOT NULL default '',
shell varchar(64) NOT NULL default '/bin/bash',
password varchar(34) NOT NULL default 'x',
lstchg bigint(20) NOT NULL default '1',
min bigint(20) NOT NULL default '0',
max bigint(20) NOT NULL default '99999',
warn bigint(20) NOT NULL default '0',
inact bigint(20) NOT NULL default '0',
expire bigint(20) NOT NULL default '-1',
flag bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE KEY username (username),
KEY uid (uid)
) TYPE=MyISAM AUTO_INCREMENT=5000;

CREATE TABLE grouplist (
rowid int(11) NOT NULL auto_increment,
gid int(11) NOT NULL default '0',
username char(16) NOT NULL default '',
PRIMARY KEY (rowid)
) TYPE=MyISAM;
GRANT USAGE ON *.* TO `nss-root`@`localhost` IDENTIFIED BY 'yourpass'; # <----- change password
GRANT USAGE ON *.* TO `nss-user`@`localhost` IDENTIFIED BY 'yourpass'; # <----- change password

GRANT Select (`username`, `uid`, `gid`, `gecos`, `homedir`, `shell`, `password`,
`lstchg`, `min`, `max`, `warn`, `inact`, `expire`, `flag`)
ON `ispcp`.`users`
TO 'nss-root'@'localhost';
GRANT Select (`name`, `password`, `gid`)
ON `ispcp`.`groups`
TO 'nss-root'@'localhost';

GRANT Select (`username`, `uid`, `gid`, `gecos`, `homedir`, `shell`)
ON `ispcp`.`users`
TO 'nss-user'@'localhost';
GRANT Select (`name`, `password`, `gid`)
ON `ispcp`.`groups`
TO 'nss-user'@'localhost';

GRANT Select (`username`, `gid`)
ON `ispcp`.`grouplist`
TO 'nss-user'@'localhost';
GRANT Select (`username`, `gid`)
ON `ispcp`.`grouplist`
TO 'nss-root'@'localhost';

quit;

Now we set up NSS auth on the system.

Edit /etc/nsswitch.conf

Look for the lines:

passwd: files
shadow: files
group: files

And change them to look as:

passwd: files mysql
shadow: files mysql
group: files mysql

Save the file.

Edit /etc/nss.mysql.conf and /etc/mss-mysql-root.conf and place the correct username/password/database on the lines.

From now on NSS first looks into shadow/passwd and the queries the database for user data. (you need to reboot)

Now let's apply ISPCP the required changes

Edit /etc/ispcp/ispcp.con and add a line as follows (I place mine at the end of the file)
USENSSMYSQL = 1

If you set this to

USENSSMYSQL = 0

the patch is completely ignored and ISPCP works with original code

Now replace /var/www/ispcp/engine/ispcp_common_methods.pl with the attached one (you'll need to rename it .pl and make it chmod 777) and you have users stored in the database.

now you are ready to install/configure heartbeat, move your relevant directories to share points and run ispcp in HA evironment.

The code in not very clean but it works.

Any idea or suggestion is welcome.

Best regards

Alessandro Bianchi


Attached File(s)
.txt  ispcp_common_methods.txt (Size: 45.65 KB / Downloads: 13)
(This post was last modified: 05-20-2010 07:12 PM by alexskynet.)
05-20-2010 01:12 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Real HA cluster implementation - BeNe - 04-19-2010, 03:58 PM
RE: Real HA cluster implementation - Nuxwin - 04-20-2010, 07:39 AM
RE: Real HA cluster implementation - Nuxwin - 04-20-2010, 06:53 PM
RE: Real HA cluster implementation - alexskynet - 05-20-2010 01:12 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)