buy tb-500

How To Set Up Master Slave Replication in MySQL

December 17th, 2014 by ayad

About MySQL replication

MySQL replication is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave database. This can helpful for many reasons including facilating a backup for the data,a way to analyze it without using the main database, or simply as a means to scale out.

This tutorial will cover a very simple example of mysql replication—one master will send information to a single slave. For the process to work you will need two IP addresses: one of the master server and and one of the slave.

This tutorial will use the following IP addresses:

12.34.56.789- Master Database

12.23.34.456- Slave Database

Setup

This article assumes that you have user with sudo privileges and have MySQL installed. If you do not have mysql, you can install it with this command:

### sudo apt-get install mysql-server mysql-client

Step One—Configure the Master Database

Open up the mysql configuration file on the master server.

### sudo nano /etc/mysql/my.cnf

Once inside that file, we need to make a few changes.

The first step is to find the section that looks like this, binding the server to the local host:

 

### bind-address  = 127.0.0.1

The next configuration change refers to the server-id, located in the [mysqld] section. You can choose any number for this spot (it may just be easier to start with 1), but the number must be unique and cannot match any other server-id in your replication group. I’m going to go ahead and call this one 1.

Make sure this line is uncommented.

### server-id        = 1

Move on to the log_bin line. This is where the real details of the replication are kept. The slave is going to copy all of the changes that are registered in the log. For this step we simply need to uncomment the line that refers to log_bin:

### log_bin      = /var/log/mysql/mysql-bin.log

Finally, we need to designate the database that will be replicated on the slave server. You can include more than one database by repeating this line for all of the databases you will need.

### binlog_do_db       = newdatabase

After you make all of the changes, go ahead and save and exit out of the configuration file.

Refresh MySQL.

### sudo service mysql restart

The next steps will take place in the MySQL shell, itself.

Open up the MySQL shell.

### mysql -u root -p

We need to grant privileges to the slave. You can use this line to name your slave and set up their password. The command should be in this format:

### GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'password';

Follow up with:

### FLUSH PRIVILEGES;

The next part is a bit finicky. To accomplish the task you will need to open a new window or tab in addition to the one that you are already using a few steps down the line.

In your current tab switch to “newdatabase”.

### USE newdatabase;

Following that, lock the database to prevent any new changes:

### FLUSH TABLES WITH READ LOCK;

Then type in:

### SHOW MASTER STATUS;

You will see a table that should look something like this:

mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |      107 | newdatabase  |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

This is the position from which the slave database will start replicating. Record these numbers, they will come in useful later.

If you make any new changes in the same window, the database will automatically unlock. For this reason, you should open the new tab or window and continue with the next steps there.

Proceeding the with the database still locked, export your database using mysqldump in the new window (make sure you are typing this command in the bash shell, not in MySQL).

### mysqldump -u root -p --opt newdatabase > newdatabase.sql

Now, returning to your your original window, unlock the databases (making them writeable again). Finish up by exiting the shell.

### UNLOCK TABLES;
### EXIT;

Import the database that you previously exported from the master database.

### mysql -u root -p newdatabase < /path/to/newdatabase.sql

Now we need to configure the slave configuration in the same way as we did the master:

### sudo nano /etc/mysql/my.cnf

We have to make sure that we have a few things set up in this configuration. The first is the server-id. This number, as mentioned before needs to be unique. Since it is set on the default (still 1), be sure to change it’s something different.

### server-id       = 2

Following that, make sure that your have the following three criteria appropriately filled out:

### relay-log         = /var/log/mysql/mysql-relay-bin.log
### log_bin               = /var/log/mysql/mysql-bin.log
### binlog_do_db            = newdatabase

You will need to add in the relay-log line: it is not there by default. Once you have made all of the necessary changes, save and exit out of the slave configuration file.

Restart MySQL once again:

### sudo service mysql restart

The next step is to enable the replication from within the MySQL shell.

Open up the the MySQL shell once again and type in the following details, replacing the values to match your information:

### CHANGE MASTER TO MASTER_HOST='12.34.56.789',MASTER_USER='slave_user', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=  107;

This command accomplishes several things at the same time:

  1. It designates the current server as the slave of our master server.
  2. It provides the server the correct login credentials
  3. Last of all, it lets the slave server know where to start replicating from; the master log file and log position come from the numbers we wrote down previously.

With that—you have configured a master and slave server.

Activate the slave server:

### START SLAVE;

You be able to see the details of the slave replication by typing in this command. The \G rearranges the text to make it more readable.

### SHOW SLAVE STATUS\G

If there is an issue in connecting, you can try starting slave with a command to skip over it:

### SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; SLAVE START; 


All done.
thank you.



“Unable to submit the form, please retry” wordpress contact form

December 12th, 2014 by ayad

if you got the following error  “Unable to submit the form, please retry” while you try to submit in wordpress site contact form

you need to follow below solutions to fix the issue

 

1- login to wordpress admin page

2- click on “Forms” on your left side> you will get menue, then click on “forms” in the menue as well

3- you get list of page, click on contact form

4- click on “preview/test”

5- scroll a bit down and untick   “Use AJAX to avoid page reload when submitting form”

6- save setting then the issue confirm will be fix,

i have tried the above solutions my self and fixed the issue

 

thank you.

How do I upgrade MySQL that comes installed with Plesk on Windows?

December 5th, 2014 by ayad

The Parallels Plesk Control Panel installed on VPS / VDS Containers and Dedicated Servers on our network also installs a version of MySQL Database Server. However this bundled version of MySQL is not always the most current available, and you may wish to upgrade MySQL to a more current version. Please follow the steps below to do so…

 

The following is taken from section “b)” at: http://kb.parallels.com/en/1077 …

MySQL server database engine for client databases. It’s located in %plesk_dir%databases\MySQL and uses port 3306 for connections. It can be updated to any latest stable version of MySQL.

To update the client MySQL server one needs to follow these steps:

1. Download the latest stable version of MySQL

2. Stop MySQL Server service.

3. Rename or backup the folder %plesk_dir%databases\mysql.

4. Create the folder %plesk_dir%databases\mysql and extract the downloaded mysql version to this folder.

5. Delete the folder %plesk_dir%databases\mysql\data.

6. Copy the folder data from the original (backed up) mysql to %plesk_dir%databases\mysql.

 

 

 

Reference

https://support.viux.com/index.php?/Knowledgebase/Article/View/174/5/how-do-i-upgrade-mysql-that-comes-installed-with-plesk-on-windows

 

Fatal error: Call to undefined function of_get_key_by_product()

November 18th, 2014 by ayad

If you got the above error then you need to use the following solutions

 

Go to plesk installation directory and then “admin\repository”
Delete the file   “registry.xml file.”
Now,Restart plesk services

 

most properly the directory will be here C:\Program Files (x86)\Parallels\Plesk\admin\repository

 

confirm will fix the issue, i have test it and works   ( for plesk 9)

i never try it for other version of plesk,,, u may try it, may it will work too

 

thanks

 

 

qmail- plesk – to find spamming ip

November 11th, 2014 by ayad

if you want to find the spammer ip in qmail plesk

tail -f /var/log/secure

 

more /usr/local/psa/var/log/maillog |grep email ID

 

mail queue   /var/qmail/bin/qmail-qread

Thank you.

Find Spammer in Exim

September 9th, 2014 by ayad

 

  1. Login to your server via SSH as the root user.
  2. Run the following command to pull the most used mailing script’s location from the Exim mail log:grep cwd /var/log/exim_mainlog | grep -v /var/spool | awk -F”cwd=” ‘{print $2}’ | awk ‘{print $1}’ | sort | uniq -c | sort -n

     

  3. Knowing the mailer.php script was sending mail into Exim, we can now take a look at our Apache access log to see what IP addresses are accessing this script using the following command:

grep “mailer.php” /home/userna5/access-logs/example.com | awk ‘{print $1}’ | sort -n | uniq -c | sort -n

 

Reference

http://www.inmotionhosting.com/support/email/exim/find-spam-script-location-with-exim

 

550 Access denied – Invalid HELO name – SmarterMail

August 2nd, 2014 by ayad

When you send an email through SmarterMail, you receive following error in bounc back email.

Remote host said: 550 Access denied – Invalid HELO name (See RFC2821 4.1.1.1)

Soltution:

  • Login as admin
  • Settings/General Settings/Server Info
  • Set the hostname to ‘mailserver.mydomain.xxx’
  • Point an A record of ‘server1’ to the ip of your server
  • Create a Reverse DNS PTR record for the server ip to resolve back to mailserver.mydomain.xxx

Downgrapde to php 5.2 cpanel

March 1st, 2014 by ayad

PHP 5.2 was removed from EasyApache due to its End of Life status. You can read about that here.

While downgrading to PHP 5.2 is not advised and is really kind of a terrible idea (given that 5.2 has been End of Life for years), cPanel provided some documentation on a way to downgrade PHP to this unsupported and end of life version here.

As outlined in that documentation you should run these commands on your server:

cd /var/cpanel/easy/apache/custom_opt_mods/
wget http://docs.cpanel.net/twiki/pub/EasyApache/EasyApacheCustomModules/custom_opt_mod-PHP5217.tar.gz
tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-PHP5217.tar.gz

Then recompile Apache using EasyApache. If you want no php except 5.2 then on the ‘PHP Version’ screen chose ‘none’, and continue. On step 4, the ‘Short Options List’ page you will see ‘PHP 5.2.17 support (no FastCGI)’ listed. Check that box and continue your EasyApache like normal.

 

reference

https://encylia.com/2014/02/23/using-php-5-2-with-cpanelwhm-11-40-and-the-new-easyapache/

RTNETLINK answers: Operation not supported – VPS

January 31st, 2014 by ayad

If yo faced this error RTNETLINK answers: Operation not supported   in VPS while you restart the  “service network restart ”

 

then you need to apply the below solitions

 

1- Login to the main node and download the RPM as per the arch.

[root@node3 ~]# wget http://repo.smartservermanagement.com/misc/iproute-2.6.32-23.el6.x86_64.rpm
2- cp iproute-2.6.32-23.el6.x86_64.rpm /vz/private/455113/fs/root/
3- vzctl enter 455113
4- rpm -qa |grep iproute
then you will get iproute-2.6.32-31.el6.x86_64 after waiting for while
5- rpm -e iproute-2.6.32-31.el6.x86_64 --nodeps
6- rpm -ivh iproute-2.6.32-23.el6.x86_64.rpm
7 - finally do service network restart  then you will see no more error
and if you ping the vps you will find it working fine


references 

http://www.hostlift.com/linux/rtnetlink-answers-no-such-device-on-a-virtuozzo-vps

Reason: Remote host said: 601 Attempted to send the message to the following ip’s

December 24th, 2013 by ayad

An error containing Reason: Remote host said: 601 Attempted to send the message to the following ip’s is returned when SmarterMail is unable to connect to the recipients e-mail server and deliver the e-mail you attempted to send.

 
To resolve the issue, please contact the recipient via alternate methods and inform them of the above. 
 
Typically this happens when the recipients mail server is offline, smtp traffic blocked by a firewall or the e-mail server not accepting connections on port 25.