#Assuming you got to instances of RabbitMQ installed on two separate computers in the same LAN segment, run the following command on both nodes (A and B):
rabbitmqctl status
# verify that both RabbitMQ nodes run EXACTLY the same Erlang version
# if they do not - upgrade Erlang on one of them to match the second Erlang version
# at the beginning of its layout the command displays RabbitMQ node name, e.g. rabbit@my-server-A - note this node name for the later use
# Check that both machines A and B can talk to each other (no firewall issues etc)
telnet localhost 4369
# Let's work on server A configuring RabbitMQ there to be clustered with server B.
# all the work is done on server A only, nothing should be done on server B
# stop rabbitmq service on server A
service rabbitmq-server stop
# add alias for B an A:
vi /etc/hosts
# add to /etc/hosts the alias of server B like it is displayed in the "rabbitmqctl status" output after "@" symbol, e.g. "10.10.10.10 my-server-B"
# use internal IP for server B alias if you got such, so the connection between serves A and B will go over internal switch
# copy Erlang cookie from the server B to the server A:
scp root@my-server-B:/var/lib/rabbitmq/.erlang.cookie /var/lib/rabbitmq/.erlang.cookie
# give the cookie file the correct ownership (comes with 'root' after copying)
chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
# start rabbitmq service
service rabbitmq-server start
#stop and reset the app
rabbitmqctl stop_app
rabbitmqctl reset
# cluster the current node (on server A) to the node on server B as a disk node
#(if you prefer to cluster node A to B as RAM node run rabbitmqctl cluster rabbit@my-server-B)
rabbitmqctl cluster rabbit@my-server-B rabbit@my-server-A
# you should see the success message here
# start the app and enjoy
rabbitmqctl start_app
#verify that two nodes are indeed clustered: use management plugin
# go to server A, HTTP on port 55672
# you should see "node" column in the Queues view, filled in with 'my-server-B' node name
Showing posts with label redhat. Show all posts
Showing posts with label redhat. Show all posts
Thursday, July 12, 2012
Saturday, June 23, 2012
Determine filesystem on Linux
df -T [device]
NOTE: for partitioned FS we should look for [device1], [device2] etc - e.g. /dev/sdf1, /dev/sdf2 (/dev/sdf FS type could be unknown in this case)
http://www.cyberciti.biz/faq/linux-how-to-determine-find-out-file-system-type/
NOTE: for partitioned FS we should look for [device1], [device2] etc - e.g. /dev/sdf1, /dev/sdf2 (/dev/sdf FS type could be unknown in this case)
http://www.cyberciti.biz/faq/linux-how-to-determine-find-out-file-system-type/
Wednesday, May 16, 2012
Adding swap space on CentOS
# login as root with
su -
# not '-' sign - important!
#allocate file: 20 GB = 20 * 1024 * 1024
dd if=/dev/zero of=/swapfile bs=1024 count=20971520
mkswap /swapfile
#set permissions:
chown root:root /swapfile
chmod 0600 /swapfile
#add immediately to OS
swapon /swapfile
# edit fstab for persistence:
vi /etc/fstab
# edit fstab by adding the following line at the end of the file:
/swapfile /swap swap defaults 0 0
# check if the swap is allocated
free -m
su -
# not '-' sign - important!
#allocate file: 20 GB = 20 * 1024 * 1024
dd if=/dev/zero of=/swapfile bs=1024 count=20971520
mkswap /swapfile
#set permissions:
chown root:root /swapfile
chmod 0600 /swapfile
#add immediately to OS
swapon /swapfile
# edit fstab for persistence:
vi /etc/fstab
# edit fstab by adding the following line at the end of the file:
/swapfile /swap swap defaults 0 0
# check if the swap is allocated
free -m
Wednesday, April 11, 2012
sudo: Sorry, you must have a tty to run sudo (SOLVED)
I found that running a cron job on CentOS I am getting an error:
sudo: Sorry, you must have a tty to run sudo
the script, running not as a root user was using a sudo command.
Some googling showed that this is what I need (run sudo visudo to edit the config file):
Defaults requiretty
Defaults:root !requiretty
Defaults:myusername !requiretty
Thus the default remains "requiretty" for everyone but for the named users.
sudo: Sorry, you must have a tty to run sudo
the script, running not as a root user was using a sudo command.
Some googling showed that this is what I need (run sudo visudo to edit the config file):
Defaults requiretty
Defaults:root !requiretty
Defaults:myusername !requiretty
Thus the default remains "requiretty" for everyone but for the named users.
Thursday, June 30, 2011
Installing MYSQL on RedHat Enterprise Linux RHEL 6.1
Get MySQL here: http://www.mysql.com/downloads/mysql/#downloads
Select TAR installation if available, get the link of TAR and run
wget [link]
Uncompress
tar -xvf MySQL-5.5.13-1.rhel5.x86_64.tar
Install server:
rpm -Uvh MySQL-server-5.5.13-1.rhel5.x86_64.rpm
Install client:
rpm -Uvh MySQL-client-5.5.13-1.rhel5.x86_64.rpm
Note this warning:
----------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h ip-10-34-70-147 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
-----------------------------------
Start MySQL:
service mysql start
Select TAR installation if available, get the link of TAR and run
wget [link]
Uncompress
tar -xvf MySQL-5.5.13-1.rhel5.x86_64.tar
Install server:
rpm -Uvh MySQL-server-5.5.13-1.rhel5.x86_64.rpm
Install client:
rpm -Uvh MySQL-client-5.5.13-1.rhel5.x86_64.rpm
Note this warning:
----------------------
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h ip-10-34-70-147 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
Please report any problems with the /usr/bin/mysqlbug script!
-----------------------------------
Start MySQL:
service mysql start
Thursday, May 21, 2009
mySQL FULLTEXT search returns no results: ft_min_word_len
MySQL FULLTEXT search query worked well until I tried to find "boy" in my DB.
No results, and I can see some records with this word directly on my phpMyAdmin screen.
The same repeated with the word "red". It can find, "blue"< "green" and "yellow", but not "red".
Well, after some searching I found that FULLTEXT in mySQL has two server variables (well, it have more of course, but these two are relevant for this issue):
ft_min_word_len = 4
ft_max_word_len = 84
Words less than 4 chars will not be indexed until you change ft_min_word_len to something less than 4 chars.
So, on Redhat/Fedora and many other Linuxes you have to edit /etc/my.cnf
The addition might look:
[mysqld]
ft_min_word_len=1
ft_max_word_len=32
Note [mysqld] header - if it is already in that file, just put two lines woth ft_ under it. It's important! If you put it under another header mySQL will not recognize it. Cost me about 2 hours two figure this stupid thing out since typically "[...]" headers are ignored by the parsing software (used as comments).
But obviously, not in my.cnf and mySQL.
On Windows with XAMPP there is a file called "my" (just "my", now extension whatsoever) in/mysql/bin folder.
It's the same my.cnf, so just add the lines into [mysqld] section there.
Verify that the change worked in phpMyAdmin ->localhost -> Varaibles
The last thing to do to get the things working is rebuilding all FULLTEXT indexes, if you got some data in the DB yet.
With phpMyAdmin you can just click "edit" link next to the FULLTEXT index name, and when the edit screen opens, click "Save" button. You will see that mySQL runs actually 'drop the old index and create the new index" query.
No results, and I can see some records with this word directly on my phpMyAdmin screen.
The same repeated with the word "red". It can find, "blue"< "green" and "yellow", but not "red".
Well, after some searching I found that FULLTEXT in mySQL has two server variables (well, it have more of course, but these two are relevant for this issue):
ft_min_word_len = 4
ft_max_word_len = 84
Words less than 4 chars will not be indexed until you change ft_min_word_len to something less than 4 chars.
So, on Redhat/Fedora and many other Linuxes you have to edit /etc/my.cnf
The addition might look:
[mysqld]
ft_min_word_len=1
ft_max_word_len=32
Note [mysqld] header - if it is already in that file, just put two lines woth ft_ under it. It's important! If you put it under another header mySQL will not recognize it. Cost me about 2 hours two figure this stupid thing out since typically "[...]" headers are ignored by the parsing software (used as comments).
But obviously, not in my.cnf and mySQL.
On Windows with XAMPP there is a file called "my" (just "my", now extension whatsoever) in
It's the same my.cnf, so just add the lines into [mysqld] section there.
Verify that the change worked in phpMyAdmin ->localhost -> Varaibles
The last thing to do to get the things working is rebuilding all FULLTEXT indexes, if you got some data in the DB yet.
With phpMyAdmin you can just click "edit" link next to the FULLTEXT index name, and when the edit screen opens, click "Save" button. You will see that mySQL runs actually 'drop the old index and create the new index" query.
Subscribe to:
Posts (Atom)