Mysql

Mysql / Mariadb performance test

Posted on

I have two different Linux servers, and wanted to test if one where faster than the other. I used mysqlslap together with the “time” command in a bash shell. # time mysqlslap –user=root –password=$(cat /root/mysql) –host=localhost concurrency=50 –iterations=100 –number-int-cols=5 –number-char-cols=20 –auto-generate-sql –verbose In this way I could get out different values from the server which […]

Apache

Idle in transaction – DELETE waiting

Posted on

We have a Linux server (Redhat Enterprise 6) running a multi-site installation of Mediawiki. In total, we have today 120 unique wiki’s, each having its one Postgresql 9.1 database. Suddenly the server stopped responding. In Apache webserver, the total number concurrent apache processes went up to Apache’s max-client setting in httpd.conf, and people couldn’t log […]

Ldap

Authenticate Postgresql client agains backend ldap

Posted on

We have a Postgresql server open to many different people at our organization. In order to add a ldap authentication you can add these 3 lines to your current pg_hba.conf file:

where the first one will allow users that access the server from localhost (either from a shell or 127.0.0.1 connections). The second line […]

bash

Open Journal System missing email logs

Posted on

I upgraded our Open Journal Systems from 2.2.2 to 2.4.2 and afterwards we saw the email logs were gone. This was related to: http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=9140 My solution was this: Established a new Postgresql server in a virtual enviroment (vmware, test-machine), and import the old and the new (upgraded) database.

ojs_old: was the original 2.2.2 database […]

Moodle

Upgrade Moodle 2.2.1 to 2.6.2+

Posted on

I tried to upgrade Moodle 2.2.1 to 2.6.2+ and got this error message:

The solution was to run these sql’s at the Mysql database:

This issue seems to be related to: https://tracker.moodle.org/browse/MDL-43147 https://moodle.org/mod/forum/discuss.php?d=217512 https://tracker.moodle.org/browse/MDL-37016

bash

Postgresql 9.1 BACKUP DUMP BASH script

Posted on

We wrote an improved postgresql dump bash script for Postgresql version 9.1. This one will save each dump file with the name: database_name_DAYNAME.sql.bz2 In this way, we would only have 7 backups at any time, because each file will be overwritten after seven days. Since our backup system (TSM) saves 7 versions of each file, […]

bash

Mysql SQL in bash one-liner

Posted on

If you just need a quick way to get some data from a mysql database in your shell (bash), you could do something like this in one line:

If you don’t like to scroll: -bash-3.2$ mysql -h your.server.edu -u db_username -pcat /path/to/your/homedir/secretpasswordfile -e “use databasename; SELECT tablename.columnname FROM tablename where id like ‘421111’ and […]

bash

Finding spam users

Posted on

We had a lot of spam users in our multisite wordpress system. This was because we had self-registration enabled for a period. Not a smart thing to do… anyway, I wrote a bash script in order to find which users id’s from the Mysql database that could potentially be spam users. With this list of […]

Mail

Alert Blog Admin php script

Posted on

I had to send emails to all the Blog admins in our WordPress Multisite installation. This is how I did it: [code lang=”php”] <?php # Alert Blog Admin php script # connect to blog db, select from, find all blog admin email adresses # get subject, body from pre-created local files, send the email # […]

Database

Postgresql 8.1 database bash dump script

Posted on

I’ve wrote a simple bash script to dump databases from a Postgresql 8.1 database server which uses the pg_dump and pg_dumpall.