Mysql replications: slave is not readonly

databasemasterMySQLreplicationslave

After setting up mysql replications with master/slave db scheme, I noticed that the slave db server is not read-only.
Of cause, after that I configured it manually in /etc/my.cnf file.

I just can't understand: isn't it the default behavior that the slaves are always running in the read-only mode or it should be always configured by hand?

Best Answer

It is quite common to not have the slave in read_only mode..

in fact, if you do not set it yourself, then it never is enabled..

A good question, is why you would actually want to set it...???

Are you trying to protect mistakes? or errors made my admin users??? or the application?
Considering MANY admins are using MySQL as root anyways, where is the protection here??
You cant exactly protect your data as you would imagine ( as everything replicated into the slave anyway )

You do know that any user with super privileges and the replication thread do not abide by the read_only??

A strong structured approach to users and privileges is the correct way to deal with replication issues, not a read_only configuration on the slave

In my honest opinion, it actually does not protect very much...or useful for anything besides stopping a few users not write.. ( which on production systems - should never happen anyways )

As an example, In Mysql-Multi-Master ( read_only is set by the scripts ) This in theory is only to simply decide which server is the "True Master" in the master-master configuration..

All in all.. Forget about read_only ( its really unneccesary, and probably wont protect you from what you imagine it will )

Related Topic