http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Procedural.Importing.External.Repl.html
Labels
amazon
apache
apt
aptitude
automate docker image
awk
aws
awstat
backup
bandwidth
bash
binary log
bond
bridge
caching
centos
centos 7
cluster
concurrency
csv
digitalocean
disk
django
docker
docker images
dovecot
drop cache
enviroment
error
explain
free
fstab
ftp
git
gluster
go
gpg
grep
grub
header
header check
icinga2
imapsync
information
innodb
ip
iproute
isolation
ispconfig
java
jenkins
jump
kdump
keepalived
kvm
linux
locale
logbuffer
lookbehind
macos
mail
maillog
matplotlib
mcrypt
memory
modrewrite
monitoring
mount
msyql ndbcluster
mta
multipath
mutt
my.cnf
mysql
mysql error
mysql optimization
mysql permission
mysqlcluster
mysqldump
nethogs
network
nginx
node
nopasswd
ntp
nxlog
openssl
optimization
parsing
parted
password
pflogsumm
php
php-fpm
php5-mcrypt
phpmyadmin
pip
policyd
post
postfix
proxy
pycurl
python
query_cache
querydict
rdesktop
rds
recommender systems
recover mysql
redhat
redolog
regex
regularexpression
resilver
roundcube
route
rsync
scrapy
script
scrub
security
service
setfacl
sftp
slow
smtp
snnp
spamassassin
spotlight
sql
squirrelmail
ssc
ssh
ssh-copy-id
ssl
startup
syslog
syslog over tls
tar
telnet
tls
tomcat
transaction
troubleshoot
tuning
ubuntu
udev
ulimit
usb
vdev removal
virtualhost
virtualization
virtualmin
vrrp
watch
webscrape
wget
x11
zfs
zfs send
zfs recv
zpool
mysql error #1005 - Can't create table (errno: 150) importing database from another server
http://stackoverflow.com/questions/9018584/error-code-1005-cant-create-table-errno-150/30102503#30102503
Reference link to stackoverflow
Reference link to stackoverflow
This could also happen when exporting your database from one server
to another and the tables are listed in alphabetical order by default.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:
vim export.sql
use databasename100;
..
...sql'sss ....
and it shall work.
So, your first table could have a foreign key of another table that is yet to be created. In such cases, disable foreign_key_checks and create the database.
Just add the following to your script:
vim export.sql
use databasename100;
SET FOREIGN_KEY_CHECKS=0;
....
...sql'sss ....
and it shall work.
linux, web, ispconfig3, python, bash, apache
mysql error
reset user password using GRUB and set grub password in the end Ubuntu 14.04 LTS
on boot menu
select "e" to edit the menu item
find line starting with "linux..." and in the end append init=/bin/bash
and press
ctrl+x
mount -o remount,rw /
passwd <username>
reboot -f
To set grub password
login as root
vim /etc/grub.d/40_custom
select "e" to edit the menu item
find line starting with "linux..." and in the end append init=/bin/bash
and press
ctrl+x
mount -o remount,rw /
passwd <username>
reboot -f
To set grub password
login as root
# grub2-mkpasswd-pbkdf2
OR
grub-mkpasswd-pbkdf2
Password: ****
Reenter password: ****
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A
Paste the encrypted long string into the file /etc/grub.d/40_custom
eg. copy the content starting from "grub.pbkdf2.sha512.10000.9CA461100..."vim /etc/grub.d/40_custom
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...
grub2-mkconfig -o /boot/grub2/grub.cfgor grub-mkconfig -o /boot/grub2/grub.cfg
if on the local terminal use help of "tee"grub-mkpasswd-pbkdf2 | tee myhelper.txt
your password content and other text are copied in myhelper.txt, edit this myhelper.txt file and cat its content to /etc/grub.d/40_custom
cat myhelper.txt >> /etc/grub.d/40_custom
grub-mkconfig -o /boot/grub2/grub.cfg
apache xss protection headers
Setting up Apache to emit NoSniff, X-Frame and X-XSS-Protection headers
Security Headers is a service which checks that your web server is not revealing too much information. It does this by checking the HTTP headers returned with every request. The service checks to see if the server information is being leaked or if it’s reporting what scripting language is being used in the X-Powered-By header.The service also checks and reports on a list of useful security headers like NoSniff, which prevents browsers from MIME-sniffing a response away from the declared content-type. It also checks for headers which prevent clickjacking and cross site scripting by detecting if X-Frame-Options and X-XSS-Protection are defined.
Add the headers to the Apache config file
I decided it would useful to implement these headers on the web servers I support. In particular I wanted to prevent other sites from framing my content within an iframe. By setting the X-Frame-Options to deny I am explicitly disallowing framing of any type. After a little research, these are the headers that my servers now emit:<IfModule mod_headers.c> Header unset ETag Header set X-Frame-Options: deny Header set X-XSS-Protection: "1; mode=block" Header set X-Content-Type-Options: nosniff Header set X-WebKit-CSP: "default-src 'self'" Header set X-Permitted-Cross-Domain-Policies: "master-only" </IfModule>If your using the Joomla CMS, then using deny on the X-XSS-Protection will prevent the media manager from working properly. In this case you will need to relax the setting to use the same origin policy:
Header set X-Frame-Options: sameorigin
ssh error
root@server1:~# service ssh restart
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_ecdsa_key
The root cause of this problem is that sshd daemon somehow is not able to load SSH host keys.
When OpenSSH server is first installed on Linux system, SSH host keys should automatically be generated for subsequent use. If, however, key generation was not finished successfully, that can cause SSH login problems like this.
Let's check if SSH host keys are found where they should be.
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_ecdsa_key
The root cause of this problem is that sshd daemon somehow is not able to load SSH host keys.
When OpenSSH server is first installed on Linux system, SSH host keys should automatically be generated for subsequent use. If, however, key generation was not finished successfully, that can cause SSH login problems like this.
Let's check if SSH host keys are found where they should be.
$ ls -al /etc/ssh/ssh*key
make sure size is not zero,
good example:-
root@server1:~# ls -al /etc/ssh/ssh*key
-rw------- 1 root root 668 Nov 30 18:12 /etc/ssh/ssh_host_dsa_key
-rw------- 1 root root 227 Dec 5 15:03 /etc/ssh/ssh_host_ecdsa_key
-rw------- 1 root root 1675 Nov 30 18:12 /etc/ssh/ssh_host_key
-rw------- 1 root root 1671 Nov 30 18:12 /etc/ssh/ssh_host_rsa_key
-rw------- 1 root root 668 Nov 30 18:12 /etc/ssh/ssh_host_dsa_key
-rw------- 1 root root 227 Dec 5 15:03 /etc/ssh/ssh_host_ecdsa_key
-rw------- 1 root root 1675 Nov 30 18:12 /etc/ssh/ssh_host_key
-rw------- 1 root root 1671 Nov 30 18:12 /etc/ssh/ssh_host_rsa_key
[SOLUTION - debian / ubuntu ]
root@server1:~# dpkg-reconfigure openssh-server
Creating SSH2 ECDSA key; this may take some time ...
[ ok ] Restarting OpenBSD Secure Shell server: sshd.
Creating SSH2 ECDSA key; this may take some time ...
[ ok ] Restarting OpenBSD Secure Shell server: sshd.
[SOLUTION - redhat/centos]
On CentOS, RHEL or Fedora, all you have to do is to restart sshd after removing existing (problematic) keys.
$ sudo systemctl restart sshd
An alternative way to regenerate SSH host keys is to manually generate them using ssh-keygen command.
$ sudo rm -r /etc/ssh/ssh*key
$ sudo systemctl restart sshd
An alternative way to regenerate SSH host keys is to manually generate them using ssh-keygen command.
$ sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
$ sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ sudo ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
Once new SSH host keys are generated, make sure that they are found in /etc/ssh directory. There is no need to restart sshd at this point.
$ ls -al /etc/ssh/ssh*key
Now try to SSH again to the SSH server to see if the problem is gone.ispconfig 3 phpmyadmin 404 not found error
ln -s /usr/share/phpmyadmin /var/www/
service nginx restart
mysupermarket.com/phpmyadmin
enter user/password and login...this will redirecto below url
http://mysupermarket.com/index.php?token=81d1f26028dc0f0f625803c2d1ccd402
it will still give
ERROR 404 - Not Found!
The following error occurred:
The requested URL was not found on this server.
Please check the URL or contact the webmaster.
insert phpmyadmin between domain.com and index.php.... like below
http://mysupermarket.com/phpmyadmin/index.php?token=81d1f26028dc0f0f03c2d1ccd402#PMAURL:server=1&target=main.php&token=81d1f26028dc0f0f625803c2d1ccd402
still need to fix....
linux, web, ispconfig3, python, bash, apache
ispconfig,
nginx,
phpmyadmin
ispconfig 3 squirrelmail "Could not move/copy file. File not attached" when trying to attach a file"
1) create directory in /usr/share/squirrelmail/ for example attach - /usr/share/squirrelmail/attach
mkdir -p /usr/share/squirrelmail/attach
2) chmod 733 -R /usr/share/squirrelmail/attach
2) squirrelmail-configure
3) choose 4(General Options) and press Enter
4) choose 2(Attachment Directory) and paste ==> /usr/share/squirrelmail/attach
press 'S' to save and exit
done !!
linux, web, ispconfig3, python, bash, apache
ispconfig,
squirrelmail
ispconfig 3 move spam to junk folder
http://www.geekonthepc.com/2012/01/23/configuring-anti-spam-spamassassin-in-ispconfig-3/
ISPConfig relies on SpamAssassin – which is, when configured correctly, a very powerful spam filter. But for some reason, it just wasn’t working on my installation of ISPConfig. Spam would get through and it can get seriously frustrating!
Thankfully I now have it cracked – and wanted to share the configuration I chose for ISPConfig and SpamAssassin. I think the correct settings vary from person to person – but if you want general spam filtering, this should show you how to get it.
Instructions
First of all, make sure a ‘spamfilter’ policy is active both for the email domain you’re using and for each email mailbox. I chose the Uncensored policy in my case – but different rules apply to each setting. I found Uncensored to be most effective, but simply choosing this won’t make it work properly.
Once you’re happy that it’s supposedly on, you need to modify the rules for the policy you chose. Head to the ‘Email’ tab, and then from the left menu select ‘Policy’ under the ‘Spamfilter’ section (see screenshot that follows).
ISPConfig relies on SpamAssassin – which is, when configured correctly, a very powerful spam filter. But for some reason, it just wasn’t working on my installation of ISPConfig. Spam would get through and it can get seriously frustrating!
Thankfully I now have it cracked – and wanted to share the configuration I chose for ISPConfig and SpamAssassin. I think the correct settings vary from person to person – but if you want general spam filtering, this should show you how to get it.
Instructions
First of all, make sure a ‘spamfilter’ policy is active both for the email domain you’re using and for each email mailbox. I chose the Uncensored policy in my case – but different rules apply to each setting. I found Uncensored to be most effective, but simply choosing this won’t make it work properly.
Once you’re happy that it’s supposedly on, you need to modify the rules for the policy you chose. Head to the ‘Email’ tab, and then from the left menu select ‘Policy’ under the ‘Spamfilter’ section (see screenshot that follows).
Select the policy you’re working with by
simply clicking on it. Then select the ‘Tag-Level’ tab. This is where
you set how sensitive SpamAssassin actually is. I found that the first
three settings needed to be set as the following:
SPAM tag level: 3
SPAM tag2 level: 3.4
SPAM kill level: 5
SPAM tag2 level: 3.4
SPAM kill level: 5
The other settings requiring a number can
be left alone. However, to make SPAM easier to separate, I’d suggest you
turn on ‘SPAM modifies subject’ and choose a tag you’d like to add to
SPAM emails. Here’s what the page might look like when you’re done (see
screenshot that follows).
Hit ‘Save’ and it’s a good’en. If you also
want to move SPAM email to a seperate Junk folder, you can do so by
going to the ‘Email Mailbox’ page from the left menu, then selecting
your email account and clicking the ‘Mail Filter’ tab. Simply tick the
‘Move Spam Emails to Junk directory’ checkbox and dodgy email will be
moved.
Hopefully that should get you going and stop infuriating SPAM emails reaching your inbox.
linux, web, ispconfig3, python, bash, apache
ispconfig,
spamassassin
Table ‘./mysql/user’ is marked as crashed and should be repaired
How to make mysql service online from crash!
mysqld started
[ERROR] /usr/sbin/mysqld: Table ‘./mysql/user’ is marked as crashed and should be repaired
[ERROR] Fatal error: Can’t open and lock privilege tables: Table ‘./mysql/user’ is marked as crashed and should be repaired mysqld ended
Which means DB: /var/lib/mysql/mysql table: “user” has been crashed.
To resolve this issue, please perform the commands below:
]# service mysql start --skip-grant-tables
now with mysql started, you can repair the mysql/user table
]# mysqlcheck -r mysql user
After that,
]# service mysql stop
]# service mysql start
OR
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> check table user;
+————+——-+———-+———————————————————-+
| Table | Op | Msg_type | Msg_text |
+————+——-+———-+———————————————————-+
| mysql.user | check | warning | Table is marked as crashed |
| mysql.user | check | warning | 6 clients are using or haven’t closed the table properly |
| mysql.user | check | error | Record at pos: 24992 is not remove-marked |
| mysql.user | check | error | record delete-link-chain corrupted |
| mysql.user | check | error | Corrupt |
+————+——-+———-+———————————————————-+
5 rows in set (0.02 sec)
mysql> repair table user;
+————+——–+———-+——————————————+
| Table | Op | Msg_type | Msg_text |
+————+——–+———-+——————————————+
| mysql.user | repair | warning | Number of rows changed from 1384 to 1385 |
| mysql.user | repair | status | OK |
+————+——–+———-+——————————————+
2 rows in set (0.48 sec)
mysql> check table user;
+————+——-+———-+———-+
| Table | Op | Msg_type | Msg_text |
+————+——-+———-+———-+
| mysql.user | check | status | OK |
+————+——-+———-+———-+
1 row in set (0.02 sec)
mysql>
#service mysql start
linux, web, ispconfig3, python, bash, apache
mysql,
mysql error
ssh port forward
Understanding SSH Port Forwarding
29 April 2015
Port forwarding (tunneling), especially the local port forwarding, is a very handy feature of SSH. This blog explains local port forwarding in detail first. After that, this blog then introduces remote port forwarding and dynamic port forwarding briefly.
How local port forwarding works
Before getting started, let us assume we have the following three hosts and want to forward all traffics to port 80 of my pc to the port 8080 of target host.
This is a case which SSH local port forwarding applies. The command to set the tunnel is:
ssh ssh_server -L 80:target:8080
This command set up a SSH connection between my PC and the SSH server. This connection, in addition to working as usual, also acts a tunnel.
When traffics arrive at port 80 of my pc, they will then go through the tunnel.
Jump three hops
Note that in fact a traffic can be originated from a forth machine. That is, you can "jump 3 hops" with a single SSH tunnel.
According to man page, the listening port will, by default, be bond to the loop back interface only. To forward traffics from other machines, one must
- Set
GatewayPortsin/etc/ssh/sshd_configto "yes". - Specify bind address. For instance (empty or * for any), on ssh client run the following command:
ssh -L :80:ssh_server:8080 target
But according to my test,
- GatewayPorts does not take effect.
- Remote port forward bind to all interface by default.
Option '-N'
Do not execute a remote command. This is useful for just forwarding ports (protocol version 2 only).
Remote Port Forwarding
As the name indicates, remote port forwarding is the reverse of local port forwarding. This time, the traffic arrives at the "remote" side will be forwarded to the host on local side.
ssh ssh_server -R :8888:target:8080 ssh ssh_server -R :8888:localhost:8080
Dynamic Port Forwarding
Yet another kind of port forwarding turns your local machine to a socket proxy. For instance, assume that your local machine locates behind firewall and all outgoing HTTP requests are filtered by the firewall. A way to circumvent this restriction is to set up an ssh server outside the firewall and employ the dynamic port forwarding technique.
- Run the following command to set up ssh tunnel.
ssh ssh_server -D 8000
- Then, in web browser, set proxy as "SOCKS Host"
localhost:8000.
Exercise: study the following picture and compare dynamic port forwarding with local port forwarding.
Check which mpm (multi processing module) apache is running prefork worker or mpm
In Ubuntu 14.04 apache2.4
You can change it by adding symbolic links for
Only one is allowed in a time.
#source /etc/apache2/envvars
#apache2 -V | grep -i "server mpm"
#httpd -V | grep -i "server mpm"
a2query -M
Tells event, prefork, workerYou can change it by adding symbolic links for
mpm_<chosen> from mods-available to mods-enabled in /etc/apache2.Only one is allowed in a time.
#source /etc/apache2/envvars
#apache2 -V | grep -i "server mpm"
#httpd -V | grep -i "server mpm"
linux, web, ispconfig3, python, bash, apache
apache
set environment or enviroment variable linux
https://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/
The issue is that Bash sources from a different file based on what kind of shell it thinks it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive login shell” it reads from the first of .bash_profile, .bash_login and .profile (only). There is no sane reason why this should be so; it’s just historical. Follows in more detail.
For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C, etc. The B1, B2, B3 means it executes only the first of those files found.
/etc/environmentThis is the best place for variables that are system-wide. This includes extending variablePATHwith paths from/usr/localor forJAVA_HOMEDo not useexporthere or duplicate definitions./etc/xprofileVery little known but very useful for everyone who uses X window system. This is executed for every user that logs into X. It is very good choice for values that are valid for every user like/usr/local. Documentation./etc/profileand/etc/profile.d/*This is a good choice for non X systems but bad for X ones. Those files are read only by shells./etc/<shell>.<shell>rc. This is not a good choice because it is single shell specific. Also forget about X.~/.xprofileThe same as 2. This is executed when the user logs into X. The variables defined here are visible to every X application. A very good place for extendingPATHwith values such as~/binor~/gocode/binor defining user specificGOPATH. Your graphical text editor or IDE started by shortcut will see those values. Documentation.~/.profileIt will be visible only for programs started from terminal or terminal emulator. It is a good choice for systems where you do not use X window system.~/.<shell>rc. This is not a good choice because it is single shell specific.
/bin/bash
The bash executable
/etc/profile
The systemwide initialization file, executed for login shells
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
~/.bash_logout
The individual login shell cleanup file, executed when a login shell exits
~/.inputrc
Individual readline initialization file
If you have ever put something in a file like .bashrc and had it not work, or are confused by why there are so many different files — .bashrc, .bash_profile, .bash_login, .profile etc. — and what they do, this is for you. The issue is that Bash sources from a different file based on what kind of shell it thinks it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive login shell” it reads from the first of .bash_profile, .bash_login and .profile (only). There is no sane reason why this should be so; it’s just historical. Follows in more detail.
For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C, etc. The B1, B2, B3 means it executes only the first of those files found.
linux, web, ispconfig3, python, bash, apache
bash,
enviroment
setup git server ubuntu 14.04 lts
install git on both gitserver and client
ssh-copy-id the publickey from client to server
mkdir -p /files/webdir.git
cd /files/webdir.git
git init --bare
chown -R gituser:gituser /files/
##On client-A
git config --global user.name "Joe blog"
git config --global user.email "joe@example.com"
we create our local git repo on /developer/djangoproject
mkdir -p /developer/djangoproject
cd /developer/djangoproject
git init .
git remote add origin root@gitserver:/files/webdir.git
to edit >> git remote set-url origin root@gitserver:/files/webdir.git
echo "hello" > index.html
git add .
git commit -m "first commits"
git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To root@gitserver:/files/webdir.git
* [new branch] master -> master
### On client-B
git clone root@gitserver:/files/webdir.git OR
git clone root@192.168.100.221:/files/webdir.git
ssh-copy-id the publickey from client to server
mkdir -p /files/webdir.git
cd /files/webdir.git
git init --bare
chown -R gituser:gituser /files/
##On client-A
git config --global user.name "Joe blog"
git config --global user.email "joe@example.com"
we create our local git repo on /developer/djangoproject
mkdir -p /developer/djangoproject
cd /developer/djangoproject
git init .
git remote add origin root@gitserver:/files/webdir.git
to edit >> git remote set-url origin root@gitserver:/files/webdir.git
echo "hello" > index.html
git add .
git commit -m "first commits"
git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To root@gitserver:/files/webdir.git
* [new branch] master -> master
### On client-B
git clone root@gitserver:/files/webdir.git OR
git clone root@192.168.100.221:/files/webdir.git
enable ssh root login linux
vim /etc/ssh/sshd_config
#PermitRootLogin without-password
PermitRootLogin yes
#PermitRootLogin without-password
PermitRootLogin yes
enable ssh password authentication
vim /etc/ssh/sshd_config
#place below at end of file
PasswordAuthentication yes
##Enable root login
vim /etc/ssh/sshd_config
#PermitRootLogin without-password
PermitRootLogin yes
#place below at end of file
PasswordAuthentication yes
##Enable root login
vim /etc/ssh/sshd_config
#PermitRootLogin without-password
PermitRootLogin yes
perl setting locale failed
root@server:~# /usr/lib/cgi-bin/awstats.pl -config=hottiehunter.com -update
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "ne_NP",
LC_ADDRESS = "ne_NP",
LC_MONETARY = "ne_NP",
LC_NUMERIC = "ne_NP",
LC_TELEPHONE = "ne_NP",
LC_IDENTIFICATION = "ne_NP",
LC_MEASUREMENT = "ne_NP",
LC_NAME = "ne_NP",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
########## solution ################
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl
"locale" is a subset of the user's environment that defines the user's language, country and any special variant preferences that the user wants to see in their user interface
locale << shows locale variables
copy below export commands to ~/.bashrc file or run below commands
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
dpkg-reconfigure locales
vim /etc/default/locale
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_PAPER = "ne_NP",
LC_ADDRESS = "ne_NP",
LC_MONETARY = "ne_NP",
LC_NUMERIC = "ne_NP",
LC_TELEPHONE = "ne_NP",
LC_IDENTIFICATION = "ne_NP",
LC_MEASUREMENT = "ne_NP",
LC_NAME = "ne_NP",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
########## solution ################
http://stackoverflow.com/questions/2499794/how-can-i-fix-a-locale-warning-from-perl
"locale" is a subset of the user's environment that defines the user's language, country and any special variant preferences that the user wants to see in their user interface
locale << shows locale variables
copy below export commands to ~/.bashrc file or run below commands
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
dpkg-reconfigure locales
vim /etc/default/locale
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
setup NTP on ubuntu 14.04 for utc timezone
apt-get install ntp ntpdate
apt-get install ntp ntpdate
cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
service ntp restart
service cron stop && service cron start
Check ntp stats
================
#ntpq -pn
-p : Print a list of the peers known to the server as well as a summary of their state.
-n : Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
*131.107.13.100 .ACTS. 1 u 39 64 377 6.668 -1.887 2.894
+199.101.100.221 130.207.244.240 2 u 12 64 377 89.209 -8.376 1.750
-129.250.35.251 129.250.36.26 2 u 36 64 377 25.029 -8.342 3.061
+129.6.15.28 .ACTS. 1 u 34 64 377 78.681 -4.869 27.612
-91.189.89.199 170.224.124.217 2 u 40 64 377 141.474 -6.736 2.311
apt-get install ntp ntpdate
cat /etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
service ntp restart
service cron stop && service cron start
Check ntp stats
================
#ntpq -pn
-p : Print a list of the peers known to the server as well as a summary of their state.
-n : Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
*131.107.13.100 .ACTS. 1 u 39 64 377 6.668 -1.887 2.894
+199.101.100.221 130.207.244.240 2 u 12 64 377 89.209 -8.376 1.750
-129.250.35.251 129.250.36.26 2 u 36 64 377 25.029 -8.342 3.061
+129.6.15.28 .ACTS. 1 u 34 64 377 78.681 -4.869 27.612
-91.189.89.199 170.224.124.217 2 u 40 64 377 141.474 -6.736 2.311
watch command linux
By default watch command runs a command or script for every two seconds by default, we can increase or decrease the interval by using -n option
minimum is 0.1 second
#watch -n 0.1 -t lsof -i
-t = supresses the time on top of display
minimum is 0.1 second
#watch -n 0.1 -t lsof -i
-t = supresses the time on top of display
linux, web, ispconfig3, python, bash, apache
monitoring,
watch
postfix header check
https://www.howtoforge.com/community/threads/howto-spam-control-for-postfix.48608/
http://mattshaw.org/news/how-to-filter-mail-with-postfix-header_checks/
https://posluns.com/guides/header-checks/
https://www.howtoforge.com/community/threads/postfix-header-checks.80/
http://mattshaw.org/news/how-to-filter-mail-with-postfix-header_checks/
https://posluns.com/guides/header-checks/
https://www.howtoforge.com/community/threads/postfix-header-checks.80/
ispconfig3 setup on debian jessie remove default page setting
https://www.howtoforge.com/tutorial/perfect-server-debian-8-jessie-apache-bind-dovecot-ispconfig-3
+ remove /etc/apache2/sites-enabled/000-default..conf
or echo > /etc/apache2/sites-enabled/000-default..conf
+ remove /etc/apache2/sites-enabled/000-default..conf
or echo > /etc/apache2/sites-enabled/000-default..conf
python pip install without cache
From documentation at https://pip.pypa.io/en/latest/reference/pip_install.html#caching:
Starting with v6.0, pip provides an on by default cache which functions similarly to that of a web browser. While the cache is on by default and is designed do the right thing by default you can disable the cache and always access PyPI by utilizing the --no-cache-dir option.pip install pillow --no-cache-dir |
install nethogs on centos 7
I’ve just found that ‘nethogs’, a bandwidth monitoring software is
not covered in the EPEL for Centos 7. This is a memo for how to install
nethogs on CentOS 7.
1. Install the dependencies necessary.
2. Download and install the RPM package.
1. Install the dependencies necessary.
yum install libpcap-devel -y
|
rpm -ivh http://cdn.kanachan.me.uk/dl/rpms/nethogs/nethogs-0.8.0-1.el6.x86_64.rpm
linux, web, ispconfig3, python, bash, apache
monitoring,
nethogs
pflogsumm postfix mail log analyzer pflog
yum install perl-Date-Calc
sudo curl -O http://jimsun.linxnet.com/downloads/pflogsumm-1.1.3.tar.gz
tar -xzf pflogsumm-1.1.3.tar.gz
mv pflogsumm-1.1.3 pflogsumm
chmod +x pflogsumm/pflogsumm.pl
perl /usr/local/pflogsumm/pflogsumm.pl /var/log/maillog
# generate log summary for yesterday
[root@mail ~]# perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
To run cronjob for pflogsumm
crontab -e
# send mail log summary at AM 1:00 everyday to root
00 01 * * * perl /usr/sbin/pflogsumm -e -d yesterday /var/log/maillog | mail -s 'Logwatch for Postfix' root
http://jimsun.linxnet.com/postfix_contrib.html
https://www.dropbox.com/s/rkbp13lz4eon988/pflogsumm-1.1.3.tar.gz?dl=0
start a daemon at startup ubuntu
- To start a daemon at startup:
update-rc.d service_name defaults - To remove:
update-rc.d -f service_name remove
Example:
update-rc.d tomcat7 defaults
difference between use of port 25 465 and 587
port 25 is used for transmitting email between MTA's also known as SMTP relaying.
port 465 is no longer used on ssl-smtp(although port 465 was never published as an official SMTP transmission or submission channel by the IETF ) and IANA has now assigned 465 to new service called "urd".
The RFC proposed a split of the traditional message submission and message relay concept. The RFC defined that message submission should occur over port 587 to ensure new policy and security requirements don't interfere with the traditional relay traffic over message relay port 25.
Port 587 is for msa - it is almost like standard SMTP port. SSL encryption may be started by STARTTLS command at SMTP level if server supports it and your ISP does not filter server's EHLO reply (reported 2014 Nov). MSA should accept email after authentication (e.g. after SMTP AUTH). It helps to stop outgoing spam when netmasters of DUL ranges can block outgoing connections to SMTP port (port 25)
port 465 is no longer used on ssl-smtp(although port 465 was never published as an official SMTP transmission or submission channel by the IETF ) and IANA has now assigned 465 to new service called "urd".
The RFC proposed a split of the traditional message submission and message relay concept. The RFC defined that message submission should occur over port 587 to ensure new policy and security requirements don't interfere with the traditional relay traffic over message relay port 25.
Port 587 is for msa - it is almost like standard SMTP port. SSL encryption may be started by STARTTLS command at SMTP level if server supports it and your ISP does not filter server's EHLO reply (reported 2014 Nov). MSA should accept email after authentication (e.g. after SMTP AUTH). It helps to stop outgoing spam when netmasters of DUL ranges can block outgoing connections to SMTP port (port 25)
linux, web, ispconfig3, python, bash, apache
information,
mta,
smtp
REDHAT CLUSTER part 3 - Adding cluster resources and services
Make sure selinux is disabled or in permissive for testing
Adding cluster resources and services
Cluster SERVICE = 1 or more RESOURCES
resource are defined within <rm> </rm> eg.
<rm>
<resources> ...
...
</resources>
</rm>
cluster resources are configured with resource scripts and located at /usr/share/cluster along with cluster resources
[root@c1 cluster]# ls /usr/share/cluster/
apache.metadata lvm.metadata oralistener.metadata
apache.sh lvm.sh oralistener.sh
...
..
On any one node for example im on node 3 edit /etc/cluster/cluster.conf
[root@c3 cluster]# cat cluster.conf
<?xml version="1.0"?>
<cluster config_version="4" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth1"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
</rm>
</cluster>
validate configuration
[root@c3]# ccs_config_validate
Configuration validates
Distribute cluster conf with below command and enter ricci user password for all nodes respectively
[root@c3]# cman_tool version -r
You have not authenticated to the ricci daemon on c3
Password:
You have not authenticated to the ricci daemon on c2
Password:
You have not authenticated to the ricci daemon on c1
Password:
[root@c3 ~]# clustat
Cluster Status for hacluster @ Fri Aug 28 17:00:32 2015
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
c1 1 Online, rgmanager
c2 2 Online, rgmanager
c3 3 Online, Local, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:webserver c3 started
[root@c3 ~]# ip ad | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.0.77/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.88/24 scope global secondary eth0 #virtual ip
inet6 fe80::a00:27ff:fe2e:2480/64 scope link
Adding cluster resources and services
Cluster SERVICE = 1 or more RESOURCES
resource are defined within <rm> </rm> eg.
<rm>
<resources> ...
...
</resources>
</rm>
cluster resources are configured with resource scripts and located at /usr/share/cluster along with cluster resources
[root@c1 cluster]# ls /usr/share/cluster/
apache.metadata lvm.metadata oralistener.metadata
apache.sh lvm.sh oralistener.sh
...
..
On any one node for example im on node 3 edit /etc/cluster/cluster.conf
[root@c3 cluster]# cat cluster.conf
<?xml version="1.0"?>
<cluster config_version="4" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth1"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
</rm>
</cluster>
validate configuration
[root@c3]# ccs_config_validate
Configuration validates
Distribute cluster conf with below command and enter ricci user password for all nodes respectively
[root@c3]# cman_tool version -r
You have not authenticated to the ricci daemon on c3
Password:
You have not authenticated to the ricci daemon on c2
Password:
You have not authenticated to the ricci daemon on c1
Password:
SERVICES
We can configure a web server cluster service with respect to the configured IP address and Apache web server resources with the following CMAN configuration file syntax:
Make sure to increase config_version here i have number "8"
[root@c1 ~]# ccs_config_dump
<?xml version="1.0"?>
<cluster config_version="8" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth0"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
<service autostart="1" name="webserver" recovery="relocate">
<ip ref="192.168.0.88"/>
<apache ref="apache"/>
</service>
</rm>
<cman nodename="c1" cluster_id="10117"/>
</cluster>
<?xml version="1.0"?>
<cluster config_version="8" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
<resources>
<ip address="192.168.0.88" family="IPv4" prefer_interface="eth0"/>
<apache config_file="conf/httpd.conf" name="apache" server_root="/etc/httpd" shutdown_wait="60"/>
</resources>
<service autostart="1" name="webserver" recovery="relocate">
<ip ref="192.168.0.88"/>
<apache ref="apache"/>
</service>
</rm>
<cman nodename="c1" cluster_id="10117"/>
</cluster>
Cluster Status for hacluster @ Fri Aug 28 17:00:32 2015
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
c1 1 Online, rgmanager
c2 2 Online, rgmanager
c3 3 Online, Local, rgmanager
Service Name Owner (Last) State
------- ---- ----- ------ -----
service:webserver c3 started
[root@c3 ~]# ip ad | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.0.77/24 brd 192.168.0.255 scope global eth0
inet 192.168.0.88/24 scope global secondary eth0 #virtual ip
inet6 fe80::a00:27ff:fe2e:2480/64 scope link
REDHAT CLUSTER part 2 - Setting up corosync , CMAN, and RGmanager centos 6.7
Disable SELinux on all nodes
setenforce 0
All nodes are under oracle virtual box:-
number of cluster nodes : 3
setup static ip for all 3 nodes and proper hostname
example
[root@c1 cluster]# cat /etc/hosts
127.0.0.1 localhost
192.168.0.55 c1.example.com c1
192.168.0.66 c2.example.com c2
192.168.0.77 c3.example.com c3
Setup proper gateway( setup similar config in other 2 nodes)
[root@c1]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=c1.example.com
GATEWAY=192.168.0.235
[root@c1 ]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:2E:24:80
TYPE=Ethernet
UUID=02e21921-20a5-4490-bf4a-052ab8cb6c11
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.0.55
NETMASK=255.255.255.0
NTP configuration: ON ALL 3 nodes. You must install and start the NTP time synchronization
service to maintain consistent time throughout the cluster:
[root@node-1 ~]# yum install ntp –y
Installation time is synchronized with official CentOS NTP
servers. If you want to change this, edit the NTP configuration file at /etc/
ntp.conf.
You must start the NTP service and make sure it starts at boot. In the
following screenshot, you can see the commands used:
[root@c1 ~]# service ntpd start
[root@c1 ~]# chkconfig ntpd on
Setting up corosync
setup iptables to allow cluster communication traffic among cluster nodes. You must add an iptables rule to allow UDP traffic on 5404 and 5405, and another rule to allow multicast traffic communication :
iptables -I INPUT -m state --state NEW -p udp -m multiport --dports 5404,5405 -j ACCEPT
iptables -I INPUT -m addrtype --dst-type MULTICAST -j ACCEPT
The default Corosync cluster communication ports are 5404 and
5405, and the UDP protocol is used. The ports are configured in the
/etc/corosync/corosync.conf configuration file. If you want
to change the default Corosync communication ports, make sure you
change iptables accordingly.
service iptables save
yum install corosync -y #do it on all nodes
#generate corosync encryption key on any one node and transfer it to rest of nodes
#corosync-keygen
it might take long time so to speed up
dd if=/dev/random of=test123.log
Make backup of original file and rename on any one node.
[root@c1 ~]# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf
#vim corosync.conf
Remove all commented-out lines—lines starting with #—and change the
secauth parameter to on.
Change the bindnetaddr parameter to the current cluster node's IP address.
* Remove all commented-out lines—lines starting with #—and change the
secauth parameter to on.
* Change the bindnetaddr parameter to the current cluster node's IP address.
* Change the to_syslog parameter to no. We will use a separate log file, so there's no need to duplicate the information in syslog.
Now scp the corosync.conf to all rest of nodes
On all nodes
#service corosync start
#chkconfig corosync on
To check if members have joined
[root@c3 ~]# corosync-objctl | grep member.*ip
runtime.totem.pg.mrp.srp.members.3.ip=r(0) ip(192.168.0.77)
runtime.totem.pg.mrp.srp.members.1.ip=r(0) ip(192.168.0.55)
runtime.totem.pg.mrp.srp.members.2.ip=r(0) ip(192.168.0.66)
You can stop corosync for some time on all nodes
#service corosync stop
Install CMAN on all nodes
yum install cman -y
Create cluster.conf file on any one node and copy to rest of nodes
cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
</cluster>
The config_version parameter is the version of the CMAN
configuration file(it should be same on all nodes and should be increased by one+ when changed similar to serial number in bind zone configuration), and the name parameter is your preferred cluster name.
The debug parameter is set to off and should be turned on for debugging purposes.The clusternodes section is where the cluster nodes are configured. The clusternode parameter is defined by a name parameter, which is the FQDN or short node name, and the nodeid parameter, which is the ID of the cluster node.
Once the CMAN service has been successfully started on all cluster nodes, check the CMAN node status using the cman_tool nodes command. All three cluster nodes should be listed with status as M. In the following screenshot, you can see the output of the cman_tool nodes command issued on the node-1 cluster node:
[root@c1 ~]# cman_tool nodes
Node Sts Inc Joined Name
1 M 364 2015-08-26 10:53:04 c1
2 M 372 2015-08-26 10:54:14 c2
3 M 368 2015-08-26 10:53:18 c3
Let's take a look at each column in more detail:
• Node: This column shows the node ID number.
• Sts: This column shows the cluster node status, with M indicating that the
node is a joined cluster member and X indicating that the node is dead.
• Inc: This column is for debugging purposes only. It is the incarnation number.
• Joined: This column shows the time the cluster member joined the cluster.
• Name: This column shows the cluster node name as defined in the cluster.conf file.
Check quorum status:-
[root@c1 ~]# cman_tool status
Version: 6.2.0
Config Version: 3
Cluster Name: hacluster
Cluster Id: 10117
Cluster Member: Yes
Cluster Generation: 372
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 3
Node votes: 1
Quorum: 2
Active subsystems: 7
Flags:
Ports Bound: 0
Node name: c1
Node ID: 1
Multicast addresses: 239.192.39.172
Node addresses: 192.168.0.55
Nodes: This line is where the number of your cluster nodes
should be listed
Expected votes: This line shows the number of expected votes
in the currently active configuration
Total votes: This line shows the number of total votes provided
by the CMAN configuration file
Node votes: This line shows the number of votes the current
node has
Quorum: This line shows the number of votes required to reach
Quorum
The finishing touch for the CMAN installation and configuration process is the start of a service called ricci. "The ricci service provides on-the-fly CMAN configuration file distribution."
setup password for ricci user and start ricci on all nodes-
passwd ricci
Password: ********
service ricci start
chkconfig ricci on
Setup RG Manager on all nodes:-
iptables -I INPUT -m state --state NEW -p tcp -m multiport --dports 11111,21064,41966,41967,41968,41969 -j ACCEPT
service iptables save
service iptables restart
yum install rgmanager -y
service rgmanager start
chkconfig rgmanager on
Check cluster status:-
#clustat
#Member status: This line provides information about the
Quorum status.
#Member Name: This column shows the cluster node name as
defined in the cluster.conf configuration file.
#ID: This column shows the node ID number.
#Status: This column provides information about the node's
status. The output of the clustat command must list all
the cluster nodes as online, confirming that installation and
configuration of the cluster stack software on CentOS 6 were
successful and that you did a great job at it.
Edit cluster.conf file on any one node(you may need to manually create/copypaste same file on node which is offline) , make sure to increment configversion="" after making changes:-
[root@c1 ~]# cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
</cluster>
To validate
[root@c1 ~]# ccs_config_validate
Configuration validates
Once it is found valid, you can propagate to other nodes
# cman_tool version -r
Note that, if a specific cluster node is not online, the configuration file will have to be transferred manually and the cluster stack software will have to be restarted to catch up once it comes back online.
You can confirm that the configuration file was successfully
distributed by issuing the ccs_config_dump command on any of
the other cluster nodes and comparing the XML output.
[root@c3 ~]# ccs_config_dump
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
<cman nodename="c3" cluster_id="10117"/>
</cluster>
setenforce 0
All nodes are under oracle virtual box:-
number of cluster nodes : 3
setup static ip for all 3 nodes and proper hostname
example
[root@c1 cluster]# cat /etc/hosts
127.0.0.1 localhost
192.168.0.55 c1.example.com c1
192.168.0.66 c2.example.com c2
192.168.0.77 c3.example.com c3
Setup proper gateway( setup similar config in other 2 nodes)
[root@c1]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=c1.example.com
GATEWAY=192.168.0.235
[root@c1 ]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=08:00:27:2E:24:80
TYPE=Ethernet
UUID=02e21921-20a5-4490-bf4a-052ab8cb6c11
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=192.168.0.55
NETMASK=255.255.255.0
NTP configuration: ON ALL 3 nodes. You must install and start the NTP time synchronization
service to maintain consistent time throughout the cluster:
[root@node-1 ~]# yum install ntp –y
Installation time is synchronized with official CentOS NTP
servers. If you want to change this, edit the NTP configuration file at /etc/
ntp.conf.
You must start the NTP service and make sure it starts at boot. In the
following screenshot, you can see the commands used:
[root@c1 ~]# service ntpd start
[root@c1 ~]# chkconfig ntpd on
Setting up corosync
setup iptables to allow cluster communication traffic among cluster nodes. You must add an iptables rule to allow UDP traffic on 5404 and 5405, and another rule to allow multicast traffic communication :
iptables -I INPUT -m state --state NEW -p udp -m multiport --dports 5404,5405 -j ACCEPT
iptables -I INPUT -m addrtype --dst-type MULTICAST -j ACCEPT
The default Corosync cluster communication ports are 5404 and
5405, and the UDP protocol is used. The ports are configured in the
/etc/corosync/corosync.conf configuration file. If you want
to change the default Corosync communication ports, make sure you
change iptables accordingly.
service iptables save
yum install corosync -y #do it on all nodes
#generate corosync encryption key on any one node and transfer it to rest of nodes
#corosync-keygen
it might take long time so to speed up
dd if=/dev/random of=test123.log
Make backup of original file and rename on any one node.
[root@c1 ~]# cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf
#vim corosync.conf
Remove all commented-out lines—lines starting with #—and change the
secauth parameter to on.
Change the bindnetaddr parameter to the current cluster node's IP address.
* Remove all commented-out lines—lines starting with #—and change the
secauth parameter to on.
* Change the bindnetaddr parameter to the current cluster node's IP address.
* Change the to_syslog parameter to no. We will use a separate log file, so there's no need to duplicate the information in syslog.
Now scp the corosync.conf to all rest of nodes
On all nodes
#service corosync start
#chkconfig corosync on
To check if members have joined
[root@c3 ~]# corosync-objctl | grep member.*ip
runtime.totem.pg.mrp.srp.members.3.ip=r(0) ip(192.168.0.77)
runtime.totem.pg.mrp.srp.members.1.ip=r(0) ip(192.168.0.55)
runtime.totem.pg.mrp.srp.members.2.ip=r(0) ip(192.168.0.66)
You can stop corosync for some time on all nodes
#service corosync stop
Install CMAN on all nodes
yum install cman -y
Create cluster.conf file on any one node and copy to rest of nodes
cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
</cluster>
The config_version parameter is the version of the CMAN
configuration file(it should be same on all nodes and should be increased by one+ when changed similar to serial number in bind zone configuration), and the name parameter is your preferred cluster name.
The debug parameter is set to off and should be turned on for debugging purposes.The clusternodes section is where the cluster nodes are configured. The clusternode parameter is defined by a name parameter, which is the FQDN or short node name, and the nodeid parameter, which is the ID of the cluster node.
Once the CMAN service has been successfully started on all cluster nodes, check the CMAN node status using the cman_tool nodes command. All three cluster nodes should be listed with status as M. In the following screenshot, you can see the output of the cman_tool nodes command issued on the node-1 cluster node:
[root@c1 ~]# cman_tool nodes
Node Sts Inc Joined Name
1 M 364 2015-08-26 10:53:04 c1
2 M 372 2015-08-26 10:54:14 c2
3 M 368 2015-08-26 10:53:18 c3
Let's take a look at each column in more detail:
• Node: This column shows the node ID number.
• Sts: This column shows the cluster node status, with M indicating that the
node is a joined cluster member and X indicating that the node is dead.
• Inc: This column is for debugging purposes only. It is the incarnation number.
• Joined: This column shows the time the cluster member joined the cluster.
• Name: This column shows the cluster node name as defined in the cluster.conf file.
Check quorum status:-
[root@c1 ~]# cman_tool status
Version: 6.2.0
Config Version: 3
Cluster Name: hacluster
Cluster Id: 10117
Cluster Member: Yes
Cluster Generation: 372
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 3
Node votes: 1
Quorum: 2
Active subsystems: 7
Flags:
Ports Bound: 0
Node name: c1
Node ID: 1
Multicast addresses: 239.192.39.172
Node addresses: 192.168.0.55
Nodes: This line is where the number of your cluster nodes
should be listed
Expected votes: This line shows the number of expected votes
in the currently active configuration
Total votes: This line shows the number of total votes provided
by the CMAN configuration file
Node votes: This line shows the number of votes the current
node has
Quorum: This line shows the number of votes required to reach
Quorum
The finishing touch for the CMAN installation and configuration process is the start of a service called ricci. "The ricci service provides on-the-fly CMAN configuration file distribution."
setup password for ricci user and start ricci on all nodes-
passwd ricci
Password: ********
service ricci start
chkconfig ricci on
Setup RG Manager on all nodes:-
iptables -I INPUT -m state --state NEW -p tcp -m multiport --dports 11111,21064,41966,41967,41968,41969 -j ACCEPT
service iptables save
service iptables restart
yum install rgmanager -y
service rgmanager start
chkconfig rgmanager on
Check cluster status:-
#clustat
#Member status: This line provides information about the
Quorum status.
#Member Name: This column shows the cluster node name as
defined in the cluster.conf configuration file.
#ID: This column shows the node ID number.
#Status: This column provides information about the node's
status. The output of the clustat command must list all
the cluster nodes as online, confirming that installation and
configuration of the cluster stack software on CentOS 6 were
successful and that you did a great job at it.
Edit cluster.conf file on any one node(you may need to manually create/copypaste same file on node which is offline) , make sure to increment configversion="" after making changes:-
[root@c1 ~]# cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
</cluster>
To validate
[root@c1 ~]# ccs_config_validate
Configuration validates
Once it is found valid, you can propagate to other nodes
# cman_tool version -r
Note that, if a specific cluster node is not online, the configuration file will have to be transferred manually and the cluster stack software will have to be restarted to catch up once it comes back online.
You can confirm that the configuration file was successfully
distributed by issuing the ccs_config_dump command on any of
the other cluster nodes and comparing the XML output.
[root@c3 ~]# ccs_config_dump
<?xml version="1.0"?>
<cluster config_version="3" name="hacluster">
<logging debug="off"/>
<clusternodes>
<clusternode name="c1" nodeid="1"/>
<clusternode name="c2" nodeid="2"/>
<clusternode name="c3" nodeid="3"/>
</clusternodes>
<rm>
<failoverdomains>
<failoverdomain name="simple" nofailback="1" ordered="0" restricted="0">
<failoverdomainnode name="c1"/>
<failoverdomainnode name="c2"/>
<failoverdomainnode name="c3"/>
</failoverdomain>
</failoverdomains>
</rm>
<cman nodename="c3" cluster_id="10117"/>
</cluster>
x11 forwarding in ubuntu 14.04 LTS
On server
======================
apt-get install xauth
/etc/ssh/ssh_config #ssh client system-wide configuration file
Host *
ForwardX11 yes
ForwardX11Trusted yes
/etc/ssh/sshd_config #daemon configuration
X11Forwarding yes
X11DisplayOffset 10
At client
==============
ssh -X user1@192.168.0.135
echo $DISPLAY
localhost:19.0
If it says anything other than localhost, it's quite possible you are not configured properly. If it says nothing, go down to the Configuring the SSH Server line.
To perform an actual test of the graphics, run xclock. A small clock should appear on your desktop if it works.
#to run firefox browser
#firefox -no-remote
======================
apt-get install xauth
/etc/ssh/ssh_config #ssh client system-wide configuration file
Host *
ForwardX11 yes
ForwardX11Trusted yes
/etc/ssh/sshd_config #daemon configuration
X11Forwarding yes
X11DisplayOffset 10
At client
==============
ssh -X user1@192.168.0.135
echo $DISPLAY
localhost:19.0
If it says anything other than localhost, it's quite possible you are not configured properly. If it says nothing, go down to the Configuring the SSH Server line.
To perform an actual test of the graphics, run xclock. A small clock should appear on your desktop if it works.
#to run firefox browser
#firefox -no-remote
REDHAT CLUSTER series part 1 introduction
There are two common types of computer clusters:
1) Load balancing computer clusters (loadbalancers, multiple web and database servers)
2) High-availability computer clusters (eg..Redhat cluster stack- corosync,heartbeat,pacemaker etc)
Category 2 ) High-availability computer clusters strive to minimize the downtime of the service
provided and not so much to improve the overall performance of the service.
active/active
active/passive
N + 1 =The N over 1 configuration
implies the presence of N cluster members in an active/active configuration with one cluster member in backup or hot standby. The standby cluster member is ready to take over any of the failed cluster node responsibilities at
any given time.
The cluster software stack must provide two significant features:
1)cluster communication : uses tcp or udp broadcast/multicast
2)cluster resource management: Cluster resource management starts, stops, and manages applications in the cluster in general. It relies on the cluster communication layer to get the information it requires about cluster members and their status, and takes cluster resource
actions based on that
Cluster resource manager components: -
TOTEM provides cluster group communication. TOTEM provides
cluster messaging and membership services. The cluster messaging service is the communication process among cluster members. This communication process is called a
heartbeat and the formation cluster members adopt is called a ring.
TOTEM uses the broadcast method to send messages
to all recipients simultaneously.
TOTEM protocol introduces a special token, passed among the cluster members. Only the cluster member that possesses this TOKEN can broadcast messages to other cluster members. Virtual Synchrony concept was extended to allow continued operation with a so-called temporary transitional cluster configuration with reduced membership in case of cluster member failures
The Membership Protocol detects cluster member failures and rebuilds the cluster configuration, leaving out failed cluster members. A new passing token is also generated
Another very important process managed by the cluster communication layer is
called Quorum. Quorum is the minimum number of cluster member votes required to perform a cluster operation Some cluster communication software solutions support
an additional quorum disk that counts as an additional so-called tie-breaker vote.
The quorum disk is very useful and also required in an even-node cluster configuration. In a two-node cluster, only two votes are available from the cluster nodes, which means that, in the event of a cluster failure, the operational cluster node does not have quorum majority and
can't make decisions. The quorum disk is a shared storage disk to which all the cluster
members have access. All the cluster members use the quorum disk for heartbeat
communication and store cluster configuration data in it. Based on the activity on the quorum disk, cluster members can run their cluster communication via the quorum
disk, and the quorum disk can also count as a vote in the quorum process. The quorum
disk is a must in an even-node cluster configuration.
SPLIT Brain is a condition in the cluster where the cluster is split into two sides, each side thinking
that the other side is dead or inactive. In this situation, each side proceeds to take
over the resources as if the other side no longer exists. To prevent such scenarios,
an additional mechanism called FENCING is used. Before any of the split sides of the
cluster takes over the resources, the fencing mechanism fences the other side by
issuing a configured action of reboot or power-off on the cluster nodes, thus making
sure that the cluster nodes on the other side are really dead. Once successful fencing
is confirmed, the operational side can safely start the resources without any data
corruption or disruption. types of fencing: resource-level fencing and node-level fencing. Resource-level fencing is the way the cluster disables a specific or problematic node to access a specific resource. This is usually used on shared storage resources, where a
problematic node is denied access to certain shared storage. More commonly used
is node-level fencing. Node-level fencing is a way to make sure a node does not run
any resources at all.
CentOS 6 and CentOS 7. The only difference between the two versions is the cluster resource
manager software used. This means that both solutions will use the same cluster communication software, called Corosync. Corosync provides cluster communication features and
capabilities. Corosync provides TOTEM with virtual synchrony, Quorum.
Since cluster resource manager software must run on top of Corosync, this is where
the road splits into two. There are two cluster resource manager software options
to use—either RGManager or Pacemaker . Generally, Pacemaker has more features
than RGManager. RGManager also requires the CMAN software as the middle layer
between it and Corosync. CMAN is the communication layer between Corosync and
RGManager, also providing some additional functionality. It is an interesting fact
that the official Red Hat Cluster software suite in RHEL 6 version includes Corosync,
CMAN, and RGManager; in RHEL 7, however, this was changed to Corosync and
Pacemaker.https://alteeve.ca/w/Clustering
Configuration
how to calculate quorum?, the formula is:
quorum=peep(expected votes/2 + 1)
peep () function means allways round down
So if for example you hace a cluster formed by 3 nodes:
quorum=peep( 3 / 2 + 1)
quorum=peep( 1'5 + 1)
quorum=peep(2'5)
quorum=2
7 nodes..
quorum=peep (7 /2 +1 )
quorum=peep ( 3'5 +1 )
quorum=4
With cman_tool we can change the number of expected votes, lets say that we have and emergency and need to get a cluster quorate we can change the expected votes.
For example in a 3 node cluster we need to get a cluster working with only 1 node:
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 17:21:33 2013
Member Status: Quorate
[root@centos ~]# cman_tool status
Version: 6.2.0
Config Version: 5
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 60
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 3
Node votes: 1
Quorum: 2
Active subsystems: 8
Flags:
Ports Bound: 0 177
Node name: centosclu
Node ID: 1
Multicast addresses: 239.192.169.158
Node addresses: 1.1.1.2
[root@centos ~]# ccs_tool lsnode
Cluster name: newcluster, config_version: 6
Nodename Votes Nodeid Fencetype
centosclu 1 1
centos2clu 1 2
centos3clu 1 3
So lets say we loose centos2clu and centos3clu, and we need to start the cluster only with centosclu node:
we stop 1 node
[root@centos ~]# cman_tool status
Nodes: 2
Expected votes: 3
Total votes: 2
Node votes: 1
Quorum: 2
we stop 2 nodes:
[root@centos ~]#
Message from syslogd@centos at Jul 18 17:25:19 ...
rgmanager[2847]: #1: Quorum Dissolved
[root@centos ~]# cman_tool status
Membership state: Cluster-Member
Nodes: 1
Expected votes: 3
Total votes: 1
Node votes: 1
Quorum: 2 Activity blocked
[root@centos ~]# clustat
Service states unavailable: Operation requires quorum
Cluster Status for newcluster @ Thu Jul 18 17:26:22 2013
Member Status: Inquorate
So if we wan't to force the cluster to work with only one node we can change the expected votes:
[root@centos ~]# cman_tool expected -e 1
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 17:27:37 2013
Member Status: Quorate
[ root@centos ~]# cman_tool status
Nodes: 1
Expected votes: 1
T otal votes: 1
Node votes: 1
Quorum: 1
Once we recover the nodes we need to leave the expected votes back to normal otherwise we can have serious problems with data integrity.
If we wan't to modify how many votes a node adds to a cluster we have several ways, for example manually editing the cluster.conf file:
root@centos cluster]# cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
We can get info on all the parameters of the cluster.conf file from this html file:
/usr/share/doc/cman-3.0.12.1/cluster_conf.html
Once we modify the file we need to increment by one the config_version="7" number, and then distribute and activate the file using for example cman_tool:
[root@centos cluster]# cman_tool version -r
You have not authenticated to the ricci daemon on centos3clu
Password:
You have not authenticated to the ricci daemon on centos2clu
Password:
You have not authenticated to the ricci daemon on centosclu
Password:
[root@centos cluster]# ccs_tool lsnode
Cluster name: newcluster, config_version: 7
Nodename Votes Nodeid Fencetype
centosclu 2 1
centos2clu 1 2
centos3clu 1 3
[root@centos cluster]# cman_tool status
Version: 6.2.0
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 4
Node votes: 2
Quorum: 3
we can also modify expected votes to 4, so it all looks how it does:
[root@centos cluster]# cman_tool expected -e 4
[root@centos cluster]# cman_tool status
Nodes: 3
Expected votes: 4
Total votes: 4
Node votes: 2
Quorum: 3
Active subsystems: 8
Flags:
Ports Bound: 0 177
Node name: centosclu
Node ID: 1
Multicast addresses: 239.192.169.158
Node addresses: 1.1.1.2
Another exercise, we are going to give centos node 3 votes so even if we loose centos2 and centos3, we still have qourom tu run with centos.
We modify the file /etc/cluster/cluster.conf like before, and distribute it to all nodes, using ccs this time:
[root@centos4 ~]# ccs -h centos --sync --activate
We can check we have the new version working with 3 votes for node1:
[root@centos3 cluster]# cman_tool status
Version: 6.2.0
Config Version: 10
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 192
Membership state: Cluster-Member
Nodes: 3
Expected votes: 4
Total votes: 5
Node votes: 1
Quorum: 3
No we take down centos2 and centos3
[liquid@liquid-ibm:~]$ virsh destroy centos2 (07-18 11:27)
Domain centos2 destroyed
[liquid@liquid-ibm:~]$ virsh destroy centos3 (07-18 18:07)
Domain centos3 destroyed
On centos logs we can see:
Jul 18 18:08:00 centos rgmanager[2267]: State change: centos2clu DOWN
Jul 18 18:08:00 centos fenced[1866]: fencing node centos3clu
Jul 18 18:08:00 centos rgmanager[2267]: State change: centos3clu DOWN
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 18:10:03 2013
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
centosclu 1 Online, Local
centos2clu 2 Offline
centos3clu 3 Offline
[root@centos ~]# cman_tool status
Version: 6.2.0
Config Version: 10
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 196
Membership state: Cluster-Member
Nodes: 1
Expected votes: 4
Total votes: 3
Node votes: 3
Quorum: 3
- See more at: http://www.hpuxtips.es/?q=content/part5quorum-my-study-notes-red-hat-certificate-expertise-clustering-and-storage-management#sthash.sacx9AAD.dpuf
how to calculate quorum?, the formula is:
quorum=peep(expected votes/2 + 1)
peep () function means allways round down
So if for example you hace a cluster formed by 3 nodes:
quorum=peep( 3 / 2 + 1)
quorum=peep( 1'5 + 1)
quorum=peep(2'5)
quorum=2
7 nodes..
quorum=peep (7 /2 +1 )
quorum=peep ( 3'5 +1 )
quorum=4
With cman_tool we can change the number of expected votes, lets say that we have and emergency and need to get a cluster quorate we can change the expected votes.
For example in a 3 node cluster we need to get a cluster working with only 1 node:
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 17:21:33 2013
Member Status: Quorate
[root@centos ~]# cman_tool status
Version: 6.2.0
Config Version: 5
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 60
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 3
Node votes: 1
Quorum: 2
Active subsystems: 8
Flags:
Ports Bound: 0 177
Node name: centosclu
Node ID: 1
Multicast addresses: 239.192.169.158
Node addresses: 1.1.1.2
[root@centos ~]# ccs_tool lsnode
Cluster name: newcluster, config_version: 6
Nodename Votes Nodeid Fencetype
centosclu 1 1
centos2clu 1 2
centos3clu 1 3
So lets say we loose centos2clu and centos3clu, and we need to start the cluster only with centosclu node:
we stop 1 node
[root@centos ~]# cman_tool status
Nodes: 2
Expected votes: 3
Total votes: 2
Node votes: 1
Quorum: 2
we stop 2 nodes:
[root@centos ~]#
Message from syslogd@centos at Jul 18 17:25:19 ...
rgmanager[2847]: #1: Quorum Dissolved
[root@centos ~]# cman_tool status
Membership state: Cluster-Member
Nodes: 1
Expected votes: 3
Total votes: 1
Node votes: 1
Quorum: 2 Activity blocked
[root@centos ~]# clustat
Service states unavailable: Operation requires quorum
Cluster Status for newcluster @ Thu Jul 18 17:26:22 2013
Member Status: Inquorate
So if we wan't to force the cluster to work with only one node we can change the expected votes:
[root@centos ~]# cman_tool expected -e 1
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 17:27:37 2013
Member Status: Quorate
[ root@centos ~]# cman_tool status
Nodes: 1
Expected votes: 1
T otal votes: 1
Node votes: 1
Quorum: 1
Once we recover the nodes we need to leave the expected votes back to normal otherwise we can have serious problems with data integrity.
If we wan't to modify how many votes a node adds to a cluster we have several ways, for example manually editing the cluster.conf file:
root@centos cluster]# cat /etc/cluster/cluster.conf
<?xml version="1.0"?>
We can get info on all the parameters of the cluster.conf file from this html file:
/usr/share/doc/cman-3.0.12.1/cluster_conf.html
Once we modify the file we need to increment by one the config_version="7" number, and then distribute and activate the file using for example cman_tool:
[root@centos cluster]# cman_tool version -r
You have not authenticated to the ricci daemon on centos3clu
Password:
You have not authenticated to the ricci daemon on centos2clu
Password:
You have not authenticated to the ricci daemon on centosclu
Password:
[root@centos cluster]# ccs_tool lsnode
Cluster name: newcluster, config_version: 7
Nodename Votes Nodeid Fencetype
centosclu 2 1
centos2clu 1 2
centos3clu 1 3
[root@centos cluster]# cman_tool status
Version: 6.2.0
Membership state: Cluster-Member
Nodes: 3
Expected votes: 3
Total votes: 4
Node votes: 2
Quorum: 3
we can also modify expected votes to 4, so it all looks how it does:
[root@centos cluster]# cman_tool expected -e 4
[root@centos cluster]# cman_tool status
Nodes: 3
Expected votes: 4
Total votes: 4
Node votes: 2
Quorum: 3
Active subsystems: 8
Flags:
Ports Bound: 0 177
Node name: centosclu
Node ID: 1
Multicast addresses: 239.192.169.158
Node addresses: 1.1.1.2
Another exercise, we are going to give centos node 3 votes so even if we loose centos2 and centos3, we still have qourom tu run with centos.
We modify the file /etc/cluster/cluster.conf like before, and distribute it to all nodes, using ccs this time:
[root@centos4 ~]# ccs -h centos --sync --activate
We can check we have the new version working with 3 votes for node1:
[root@centos3 cluster]# cman_tool status
Version: 6.2.0
Config Version: 10
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 192
Membership state: Cluster-Member
Nodes: 3
Expected votes: 4
Total votes: 5
Node votes: 1
Quorum: 3
No we take down centos2 and centos3
[liquid@liquid-ibm:~]$ virsh destroy centos2 (07-18 11:27)
Domain centos2 destroyed
[liquid@liquid-ibm:~]$ virsh destroy centos3 (07-18 18:07)
Domain centos3 destroyed
On centos logs we can see:
Jul 18 18:08:00 centos rgmanager[2267]: State change: centos2clu DOWN
Jul 18 18:08:00 centos fenced[1866]: fencing node centos3clu
Jul 18 18:08:00 centos rgmanager[2267]: State change: centos3clu DOWN
[root@centos ~]# clustat
Cluster Status for newcluster @ Thu Jul 18 18:10:03 2013
Member Status: Quorate
Member Name ID Status
------ ---- ---- ------
centosclu 1 Online, Local
centos2clu 2 Offline
centos3clu 3 Offline
[root@centos ~]# cman_tool status
Version: 6.2.0
Config Version: 10
Cluster Name: newcluster
Cluster Id: 43508
Cluster Member: Yes
Cluster Generation: 196
Membership state: Cluster-Member
Nodes: 1
Expected votes: 4
Total votes: 3
Node votes: 3
Quorum: 3
- See more at: http://www.hpuxtips.es/?q=content/part5quorum-my-study-notes-red-hat-certificate-expertise-clustering-and-storage-management#sthash.sacx9AAD.dpuf
Subscribe to:
Posts (Atom)


