Category Archives: Uncategorized - Page 2

MySQL Multi-Master Replication Setup

So we have a bunch of websites for different markets, running wordpress, which we would ideally like hosted in their home market. BUT, we want to be able to fail them over to a different country, should the servers in their country go down. Failover in a MySQL master-slave relationship is always a bit of a pain (as it is with any DB engine) – once you’ve failed, you really can’t ‘go back’ to the original master, until you’ve re-synced it all. Which isn’t overly easy when you only have a 1 hour per 24-hr-period maintenance window, across all the markets your company operates in.

Enter MySQL Multi-Master replication. Make a change on on server? It appears on the other. Make a change on the other server? It appears on the first!

The way this works, is that each MySQL server can be both a Master, AND a Slave. So Take two servers, A and B. Any changes made on A are played via logs to the B server. Similarly, any changes on the B server are pushed to the A server. Well, actually it’s a little more than that, as Server A will send the updates it receives from Server B, on to Server B. Why does it do this?

Well, we might have six Masters! Going Master A -> Master B -> Master C -> Master D -> Master E -> Master F. And Master F is feeding Master A. All a nice big circle. So when you make a change on Master B, it propagates to C, D, E, F, and then to A. AND back to B. But B knows not to replicate its own changes on again, and they stop there.

It’s easiest to set this all up with fresh, clean, servers.

I installed MySQL-server on two clean Debian VM’s, one in Australia, one in Ireland.

Configuration

Server A – /etc/my.cnf
Add the following:

[mysqld]
# ... other configuration, tuning, etc ...
server-id = 10
# Make sure this partition has space to log bin, relay and whatever else!
log-bin = /var/lib/mysql/bin.log
relay-log = /var/lib/mysql/slave-relay.log
relay-log-index = /var/lib/mysql/slave-relay-log.index
# Creating some room between pk ids, we can always manually insert if need be.
auto_increment_increment = 10
auto_increment_offset = 1
# This is the default, but let's be safe and ensure it's on
replicate-same-server-id = FALSE
# Want more slaves in the future with writes going to both masters?
log-slave-updates = TRUE
# If there's a reboot, let's not auto start replication. - we need to make sure of where we are, and start it manually..
skip-slave-start = TRUE

Server B – /etc/my.cnf

[mysqld]
# ... other configuration, tuning, etc ...
server-id = 11
log-bin = /var/lib/mysql/bin.log
relay-log = /var/lib/mysql/slave-relay.log
relay-log-index = /var/lib/mysql/slave-relay-log.index
auto_increment_increment = 10
auto_increment_offset = 2
replicate-same-server-id = FALSE
log-slave-updates = TRUE
skip-slave-start = TRUE

You could add multiple more servers here, just increment the server-id, and the auto_increment_offset.

Starting Replication

To start replication, we first need to create a replication user on both servers, then setup the replication attributes.

First, create the replication user on both servers:
Server A

# mysql -u root -p
mysql> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO repluser@'serverb.ip.address' IDENTIFIED BY 'replpassword';

Server B

# mysql -u root -p
mysql> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO repluser@'servera.ip.address' IDENTIFIED BY 'replpassword';

Find the master info on Server B:

mysql> show master status;
+------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------+----------+--------------+------------------+
| bin.000001 | 294 | | |
+------------+----------+--------------+------------------+
1 row in set (0.00 sec)

Now we want to start the replication on Server A, using the info from Server B:

mysql>CHANGE MASTER TO
MASTER_HOST='92.1.1.1',
MASTER_USER='repluser',
MASTER_PASSWORD='replpassword',
MASTER_LOG_FILE='bin.000001',
MASTER_LOG_POS=294;
mysql>start slave;
mysql>show slave status\G

You may need to run the show slave status\G a few times, before the slave drops into the standard ‘Waiting for master to send event’ state.

Once this is done, you can then work on repeating this process to start Server B slaving from Server A.

Find the master info on Server A:

mysql> show master status;
+------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------+----------+--------------+------------------+
| bin.000001 | 293 | | |
+------------+----------+--------------+------------------+
1 row in set (0.00 sec)

Now we want to start the replication on Server A, using the info from Server B:

mysql>CHANGE MASTER TO
MASTER_HOST='202.62.1.1',
MASTER_USER='repluser',
MASTER_PASSWORD='replpassword',
MASTER_LOG_FILE='bin.000001',
MASTER_LOG_POS=293;
mysql>start slave;
mysql>show slave status\G

Exporting/Importing the Data

Now you want to create any databases, users, grants, and then import any data you want. Keep an eye on the ‘show slave status\G’ on the server opposite to where you’re doing all this, to make sure it is replicating correctly 🙂

And you’re done!

Mongoose M60 Programming

 

So, I tend to go nuts every few months, trying to find the Programming instructions for the M60/M80 Mongoose Alarms. So rather than bookmark the post I eventually find each time, and hope it doesn’t dissappear, or that I don’t lose my bookmarks, I’ll just reproduce it here 🙂

Instructions:

  1. Drivers door must be open
  2. Within 15 seconds of opening the door (note: Seems to really just be within de-arming the immobiliser), turn the ignition ON/Off the number of times for the programming charg (e.g. 3 times for remote code learning)
  3. Siren will then chirp the same number of times as the programme number.
  4. Press button one to turn the feature ‘ON’ – siren chirps once, lights flash once.
    Press button two to turn feature ‘OFF’ – siren chirps twice, lights flash twice.
  5. Leave system for 10 seconds – system quickly chirps 3 times (lights flash 3 times) to show exit of programming mode
Feature Button one (on) Button Two (Off)
3 Remote code learning
4 Ignition Door Lock ON OFF
5 Siren Chirps ON OFF
6 Turbo Timer Each press = 1 minute
Siren chirps for minutes set, max 5 mins
N/A>
7 Last Door Arming ON OFF
8 Door Diagnostics ON OFF
9 Engine Immobiliser ON OFF
10 Siren or Horn Siren Horn
11 CDL Pulse 0.8 Sec 3.5 Sec
12 NSW Siren Timing ON OFF

And it’s gone!

D’oh!

Was just having a fairly decent chat with VK4ALO (fantastic reception!), and up came the noise! currently sitting here listening to the noise sweep up and down the band.. sigh!

Though proved that the vertical was my problem! Interestingly, Paul (VK4ALO) is using a squid pole – so says something for our area, since I tried my squid pole with a wire cut for 40m, and didn’t get any better performance than the TEV-1 (though MUCH better SWR!)..

Wow, 11pm, might be time to head in and get some sleep 🙂

–edit– Ahh, noise dissappeared, and was able to finish my QSO with Paul!

Was a good night!

Woohoo, a contact

WOW!

Just WOW!

Turned on the 897 tonight, and WOW, 8 simultaneous stations on 7.03515!! That’s just incredible – says a LOT about just how insanely bad the TEV-1 was on 40m! AND I managed a contact! Well, kind of.. – I couldn’t get a lot of what JA2GSD said, but he was hearing me, and I was hearing him 🙂
VK2TDG VK2TDG de JA2GSD JA2GSD

GA ur RSQ 599 599

eiame : Kiichi Ki chi ichi

QTH ShizuoØa Shizuopa

Loc :PM94dv [348.4° 7,704.0km] PM94dv

BTU VK2TDG de JA2GSD KN

.g. VK2TDG VK2TDpée JA2GSD J
2GSD

NtQ 599 599

Ntme : Kiichi Kiichi Kiii

QT= whi, e eka Shizuoka

Loc :PM94dv PM94dv

BTU VK2TDG JA2GSD KN

Yep, not a very good decode.. but he could hear me! That’s the first time EVER I’ve been heard – not bad for the first minute of firing up on the dipole.. Well, not really a dipole when you look at it – even using the MD gal pipe, both end pipes have a decent bow in them – and the dipole centre is a good 2 metres below where it *should* be.. so I guess it’s an inverted inverted-V? does that make it a V? lol!

Close, but not quite

Well the 40m dipole (top dipole only, haven’t done the rest) is up! Although it is 1:1 swr on 6.625MHz, not 7.10MHz as calculated..

Thankfully I left a fair bit of overlap (3%, 30ish cm) incase I needed to lengthen it.. with 35cm per side (70cm total) added to the length, it is now 1:1 at 6.480MHz. Ahh of course, it needs to be shorter! Now, 35cm lengthening (per side) made it 0.145MHz lower. I want it 0.475MHz higher than the starting point.. which would make it 3.28*35cm which I want to shorten each end by? That is 1.14 metres per end?!?! That seems a little short?! And MMANA-GAL says it should be horrid! But we’ll give it a try 😉

Ok, it gets down 1.05:1 at 7.290MHz.. Hrrrm! Let’s add 40cm to the length and see if we can get it closer to 7.1 😉

Ok! measured it to 75cm longer than original (so 10.91m per side), and it’s now 1:1 at 7.05MHz. Woo!

Seems to work quite nicely on 15m as well.. we’ll see how we go on PSK31 on 40m and 15m tonight 🙂