Monday 16 April 2018

MYSQL Master Slave Replication Configuration

A. MASTER Configuration

1. Remove or comment out following 2 lines in /etc/my.cnf config file:

       skip-networking
       bind-address = 127.0.0.1

2. ADD these 3 lines in /etc/my.cnf :

log-bin = mysql-bin
binlog-do-db = sample_database
server-id=2

*Line 1: Instructs mysql what log file to use.
*Line 2: Instructs mysql which database to replicate
*Line 3: Instructs mysql that this machine is the master.

3. Restart mysqld or mariadb daemon (service mariadb restart)


4. Connect to mysql using root user & run following commands one by one :

GRANT REPLICATION SLAVE ON *.* TO 'YOUR_USER'@'SLAVE_IP_ADDRESS' IDENTIFIED BY 'YOUR_PASSWORD'; 
(New user creation & Grant Replication permissions.)

        FLUSH PRIVILEGES;

USE sample_database;   (sample_database is the database name we want to replicate)

FLUSH TABLES WITH READ LOCK;

SHOW MASTER STATUS;
Example :
+------------------+----------+--------------+------------------+
| File                   | Position | Binlog_Do_DB  | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.005  |      102   | sample_database |             |
+------------------+----------+--------------+------------------+

(Note Down this info that you get after running this command, we'll require it while setting up SLAVE)

B. SLAVE Configuration : 

1. ADD these 2 lines in my.cnf : 

server-id=3
replicate-do-db=sample_database

2. Restart mysqld or mariadb daemon (service mariadb restart)

3. Connect to mysql using root user & run following commands one by one :

CHANGE MASTER TO MASTER_HOST='IP_ADDRESS_OF_MASTER', MASTER_USER='USER', MASTER_PASSWORD='USER_PASSWORD',
MASTER_LOG_FILE='mysql-bin.005', MASTER_LOG_POS=102;

Where:
IP_ADDRESS_OF_MASTER is the actual IP address of the Master server.
USER is the actual user you created on the Master.
USER_PASSWORD is the actual password you gave the user on the Master.
mysql-bin.005 is the File name from the output of the SHOW MASTER STATUS command         from above.
MASTER_LOG_POS is the Position given in the output of the SHOW MASTER STATUS     command from above.

4. Start/Stop & check status commands for slave : 

   SLAVE START;  (Leave it running for auto sync)
   SHOW  SLAVE STATUS;  (Gives status of slave daemon)
   SLAVE STOP;   (To stop slave replication)


(Article referred : https://stackoverflow.com/questions/7707859/mysql-database-sync-between-two-databases)


--------------------------END OF CONFIGURATION--------------------------


TROUBLESHOOTING GUIDELINES :


A. SOME Nice Troubleshooting STEPS :

1. First, make sure you have run CHANGE MASTER TO and configured the server as a replica. If you’ve done this, you should get some output from SHOW SLAVE STATUS. If so, go to the next step.

2. Next, make sure you have set a server ID on both the master and the replica. Try running SHOW VARIABLES LIKE 'server_id' on both servers. If the value is zero or one, check the configuration file for an explicit setting, because zero or one is often the default value when nothing is specified. I have seen this cause the replica to fail, even in cases where the master’s ID is 1, which ought to work okay but sometimes doesn’t.

3. Finally, make sure your master and replica have different server IDs (on small networks, I usually set the server ID to the last octet in the server’s IP address, because it’s handy and easy to remember). MySQL replicas will refuse to replicate from a master with the same ID.

**Also Refer : https://dev.mysql.com/doc/refman/5.7/en/replication-problems.html (For troubleshooting tips)

B.  If  in case slave_sql_running is NO & slave_io_running is YES do following : 

 STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; 
START SLAVE;
Refer : https://serverfault.com/questions/872911/slave-sql-running-no-mysql-replication-stopped-working

..................................................Troubleshooting ends.............................................

II. Replicating Multiple Databases (Multiple Master Slave):

(https://forums.mysql.com/read.php?26,171776,205870)
=============================
MASTER: add lines to my.cnf
=============================
binlog-do-db=database_name_1
binlog-do-db=database_name_2
binlog-do-db=database_name_3
=============================
MASTER: SQL SYNTAX
=============================
GRANT REPLICATION SLAVE ON *.* TO 'user'@'%' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
SHOW MASTER STATUS;
output> file | Position | Binlog_Do_DB
mysql-bin.000963 1570 database_name_1,database_name_2,database_name_3
=============================
SLAVE: add lines to my.cnf
=============================
replicate-do-db=database_name_1
replicate-do-db=database_name_2
replicate-do-db=database_name_3
=============================
SLAVE: SQL SYNTAX
=============================
SLAVE STOP;
CHANGE MASTER TO MASTER_HOST='192.168.0.2', MASTER_USER='user', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000963', MASTER_LOG_POS=98;
START SLAVE;
SHOW SLAVE STATUS;

NOTE:

MASTER_LOG_FILE='mysql-bin.000963', MASTER_LOG_POS=98; is displayed when you run the SQL command from the master: cmd mysql#> SHOW MASTER STATUS;

ALSO:

When you run #> SHOW SLAVE STATUS;
make sure you see: Slave_IO_Running | Slave_SQL_Running
Yes Yes


Wednesday 4 October 2017

Palam Colony Raj-Nagar MCD Election Result - Candidate & Ward Wise Complete Winner List

PARTYCANDIDATE NAMESTATUS
BJPBHUPENDER GUPTAwon
INCVINOD KUMAR YADAVlost
BSPHARNEK SINGHlost
SHIVSENAABHISHEK YOGIlost
AAPPOONAM BHARDWAJlost
INDOM BIRlost
INDDIWAKAR CHAUBEYlost
INDCHANDRA SHEKHAR SINGH JEENAlost
INDSATYA PRAKASH PANDEYlost
INDMAHAVIR SINGH PUSHKARlost
INDPRABHAWATIlost
INDSURENDER SINGH BISHTlost
INDRAM NIWASlost
INDSHUBH RAMlost
INDJAGDISH SHARMAlost
INDANJU SINGHlost
INDPRADEEP SAINIlost

palam rajnagar part 2 MCD councillor

Delhi MCD election 2017

BHUPENDER GUPTA (Winner)

046-S-RAJ NAGAR (SOUTH DELHI)
Party:BJP
S/o|D/o|W/o: Sh.Shiv Dayal Gupta
Age: 51
Address: 669,Gali No 16,Raj nagar -II palam colony ND-110077
Name Enrolled as Voter in: (Delhi) constituency , at Serial no 0 in Part no 0
Email:
Contact Number:
Self Profession:Teacher (private)
Spouse Profession:teacher (private)

Palam MCD councillor - Aman Kumar

Delhi MCD election 2017

AMAN KUMAR (Winner)

054-S-PALAM (SOUTH DELHI)
Party:BJP
S/o|D/o|W/o: Shri Hari Prakash
Age: 50
Address: Resident of WZ-53, Mohalla Chhotial, Palam Village, New Delhi-110045
Name Enrolled as Voter in: (Delhi) constituency , at Serial no 0 in Part no 0
Email:
Contact Number:
Self Profession:Document Writer
Spouse Profession:House Wife

DDA least bothered about making palam-Dwarka flyover safe

New Delhi: It is among the most dangerous roads for drivers in Delhi, with over 145 accidents reported in 2012-16. But Delhi Development Authority seems in no hurry to make the Dwarka flyover safer. For eight months now, it has been sitting on the prescription given by the Central Road Research Institute to minimise accidents on the 2-km stretch.

The flyover, constructed above a densely populated area, is a vital connection between Dwarka and south Delhi, but has become a serious concern for traffic police. To make the flyover safer, DDA had asked CSIR-CRRI in 2015 to conduct a safety audit. The audit report was submitted in January this year, but nothing has been done to carry through its advice.

CSIR-CRRI noted serious problems on the elevated road, but its officials said that DDA was yet to hold a meeting to discuss the audit findings. "As a policy, we present the audit findings and have a closure meeting to clarify doubts that the agency that has given us the task might have," said Dr S Velmurugan, senior principal scientist, traffic engineering and safety division, CSIR-CRRI. "There has been no meeting with DDA officials till date."






Among the foremost problem that the road experts noted on the flyover was the lack of shielding from the headlights of oncoming traffic. Because of the narrow road width, the median verge is not spacious enough for the greenery curtain. CSIR-CRRI, therefore, recommended the installation of anti-glare screens between the two carriageways. DDA did put up such screens on one of the five curves on the length of the flyover, but these have gone missing now.


Road delineators are missing at several places, particularly near curves, as are crash cushions near the mouth of the flyover and at the ramp leading to Palam Village. "We found the bollards damaged and the chevron markings faded. These are important from the point of road safety," added Velmurugan. "Crash cushions might be a bit expensive, but these are necessary on this stretch."


he report suggested that DDA and traffic police should replace all non-standard traffic signs with those complying with India Road Congress specifications. It asked for proper signboards to indicate the curves and the on/off ramps.


Delhi traffic officials admitted the need for such measures, including reflectors at curves and speed calming devices. Without outlining a time frame for implementing CSIR-CRRI's recommendations, a senior DDA official said, "These will be executed soon."

Source - Times Of India (TOI) - timesofindia.indiatimes.com/city/delhi/dda-in-no-hurry-to-make-dwarka-flyover-safe/articleshow/60875708.cms