Coming up with a unique MySQL server-id

The server-id, is used in replication to give each master and slave a unique identity. For each server participating in replication, you should pick a positive integer in the range from 1 to 2^32 – 1 to act as that server’s ID. To come up with this id convert the IP address of the server to an integer as follows

IP address 10.8.208.31

First Octet: 10
Second Octet: 8
Third Octet: 208
Fourth Octet: 31

(first octet * 256^3) + (second octet * 256^2) + (third octet * 256) + (fourth octet)
server-id = (10 * 16777216) + (8 * 65536) + (208 * 256) + (31)
server-id = 168349727

Leave a Reply