How to Install Percona on CentOS7

Hello dear readers,

I’ve been checking the MySQL server options and new features which show that far from dying as many predicted when it fell under Oracle, it has evolved to something awesome.

In this post, I will use Percona for reasons I’d like to keep undisclosed. So let’s get started.

The easiest way to get up and running with Percona is to rely on the YUM repositories.

# yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm

This will install the Percona repository on your system so that you can then install the actual server and additional tools.

# yum install Percona-Server-server-57

This installs the server software, but doesn’t start the service. You need to manually start it for the first time.

# systemctl start mysql

After you get Percona MySQL running, you need to update your root password.

# cat /var/log/mysqld.log | grep generated
2018-03-24T15:54:37.006018Z 1 [Note] A temporary password is generated for root@localhost: Mr9nwsjduw=j

Use that password to login on your database and set your own:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Your#Pass');

You’re all set! Grab your SQL Database Client of choice and start managing your Percona server!

Advertisements

SSH Connection Manager in Linux – Perl Auto Connector

Hello everyone,

Recently I found an awesome piece of software that can save you tons of time if you connect to several hosts through SSH from Linux.

In Windows, there are several choices like Putty CM (dead) or SuperPutty, which let you store connection data and connect to a host simply by double-clicking on the connection name later.

In Linux, the Perl Auto Connector (PAC) does this and does it very well.

It’s developed for Debian based distros, but you can find it the RPM package as well in their project page: https://sourceforge.net/projects/pacmanager/

Just go over to the “Files” tab and suit yourself.

You may run into a couple issues after installing, since it relies in some included libraries that must be removed  prior to being able to use it

After you install the RPM package, run the following

sudo find /opt/pac/ -name "Vte.so*" -exec rm {} +
sudo yum -y install perl-Gnome2-Vte

That will force the program to rely on global libraries instead of embedded libraries.

Enjoy!

 

How to ‘find’ with argument list too long

Hello dear readers,

Today I’m going to share a very short, but (I hope) useful piece of information for some Linux admins and DBAs as well.

The find tool is very good in isolating files that match a certain pattern.

I use it, in particular, for cleaning up old logs and files that are no longer required in file system if you generate 5 to 10 logs a day. You could even do this manually, but when you generate 5 to 10 logs per minute, you need to automate this as much as you can.

So piping the following commands together do the job nicely

find . -name *xmin*.log -mtime +30 | xargs -r rm -f

Or so I thought.

Lately I have been receiving the following error:

/usr/bin/find: Argument list too long

A shame… Cleanup is not working anymore and I have to go over it manually. But manually doesn’t work either as the number of files is huge.

Turns out that the error pops up at substitution time because of the pattern *xmin*.log. It doesn’t act as a pattern at all but as a list of all the files that match that pattern.

So, if you want it to work as expected, just enclose it in single quotes as follows:

find . -name '*xmin*.log' -mtime +30 | xargs -r rm -f

And that’s it… You’re back in the automated game!

Shell script to download files or directories from SVN (or web)

Hello everybody!

Today I bring to you a new public Gist that holds a shell script that you can use to download 1 file, a list of files or an entire directory from the SVN (or any webpage for what matters) with a single run.

The only important prerequisite for it to run successfully is that WGET is installed in the linux box where you’re going to run it.

Enjoy!

Hope you find this useful. If so, please share it!

Utility Script

When working with shell scripts it’s always useful to have common functions grouped in one or more scripts that can be sourced from the running script needing the functions.

I have placed some of my own scripts in a public GitHub so that we can all share them and use them. Here you have my personal utility function script.

Enjoy and, if you like it, share!

Hope this brings some automation and code organization to your job.