We all have the luxury of using various open source and free software products. I'm a huge user of PostgreSQL, MySQL, various os/x utilities, etc. I recently started a gig at a government site and have found they have a strange, but understandable, relation to open source software.
I was trying to get them to use a Wiki type product instead of Microsoft's SharePoint. At the same time we were considering moving some databases to Cassandra. In both cases, the requests went through the rather lengthy approval process only to come back rejected.
Why? Because in the government you cannot use or install any open source product unless you have engaged a vendor to support you. Supposedly it's the law. Go figure.
Of course this almost defeats the purpose of open source software, but then if you look at it from the point-of-view of the vendors who make all their money from the government it makes perfect sense. They have pressured someone to get this enacted to give them a steady stream of income. Forget that it may make no sense, it is the rule and so without a contract, without a billing vehicle, and without a vendor there's tons of software we cannot use. It really ties the hands of the government folks who want to do the right thing but are kept from doing so.
I love this job.
Monday, March 20, 2017
Wednesday, March 8, 2017
systemctrl seems to ignore my.cnf no matter where it lives. selinux is in the way!
I recently faced a daunting problem. The systems group turned over a new host to me, mysql was installed but not running, my configuration file was present, and all seemed perfect.
I double checked /etc/my.cnf and tweaked a couple of settings and went to initialize the db and get it running. mysqld --initialize-insecure
worked perfect, my new ibdata and ib_logfile files got created, the log was clean, and I thought whoopee, let's just start this up.
systemctl start mysqld
was my next command.
Whoa!. What's going on here. All the log messages are going to /var/log/messages and mysql is not starting but is cycling up and down up and down. Pretty soon /var/log/messages was full and my bad hair day began.
Well there must be a renegade my.cnf file somewhere. Checking mysqld to see where it thought the files might live I ran
mysqld --help --verbose
and found the lines
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
I double checked /etc/my.cnf and tweaked a couple of settings and went to initialize the db and get it running. mysqld --initialize-insecure
worked perfect, my new ibdata and ib_logfile files got created, the log was clean, and I thought whoopee, let's just start this up.
systemctl start mysqld
was my next command.
Whoa!. What's going on here. All the log messages are going to /var/log/messages and mysql is not starting but is cycling up and down up and down. Pretty soon /var/log/messages was full and my bad hair day began.
Well there must be a renegade my.cnf file somewhere. Checking mysqld to see where it thought the files might live I ran
mysqld --help --verbose
and found the lines
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
and so dutifully went off to see if one of those other files existed and was overwriting my options.
No such luck. The sound you hear is my hair being pulled out. After 72 hours, reinstalling mysql, running initialize multiple time, making my.cnf small with just a few options I was no closer to a solution.
But then (clue music) I remembered having something like this a long time ago. selinux. Checking
/etc/selinux/config I found
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
which is exactly what I would expect EXCEPT that the time stamp was more recent than the latest uptime. Sure enough, the os team had fixed selinux like I asked, but they forgot to reboot the host. selinux was getting in my way and until it was resolved mysql would never start.
Now, after a reboot, all was well, mysql reads my my.cnf and starts up just fine.
Remember, after disabling selinux you must reboot. I surely won't forget to check this again.
Thursday, January 5, 2017
mange the size of slow query logs
The mysql slow query log is great. But if you don't use if often, or as is likely, never look at it until there is an issue, it can grow unwieldy. Fortunately Percona's mysql clone has options to let you have n copies of the slow query log, each of a maximum size, so that it rotates the logs and keeps the size(s) under control.
You probably already have something like this in your my.cnf file
slow_query_log=1
slow_query_log_file=/somewhere/slow_query.log
So now add this to get additional copies and rotate amongst them.
max_slowlog_size=500M
max_slowlog_files=10
Thank you Percona for yet another great feature.
You probably already have something like this in your my.cnf file
slow_query_log=1
slow_query_log_file=/somewhere/slow_query.log
So now add this to get additional copies and rotate amongst them.
max_slowlog_size=500M
max_slowlog_files=10
Thank you Percona for yet another great feature.
Subscribe to:
Posts (Atom)