Server Administration

Varnish - identify account with highest traffic

If you are running on your server multiple domains and content is cached through Varnish, often you need to identify in real time who is generating highest traffic. Here are some varnish 4.x commands we use to identify accounts with highest traffic: 1. Sorted list of hostnames with highest number of requests: varnishtop -C -I ReqHeader:Host Output could look like this: 2. Another common task is to find the most frequently executedURL: varnishtop -i ReqURL Here is example of output: 3. If y...

Upgrade MariaDB 10.0.x to MariaDB 10.1.x on Centos (yum)

Here are steps you should do to upgrade your older MariaDB 10.1.x to the latest version of MariaDB 10.1.x. 0. Prepare for upgrade - make sure no traffic is coming to database server - make backup of configuration files /etc/my.cnf* - backup all your databases running on the server in case something goes wrong during upgrade 1. Update yum repository config located in/etc/yum.repos.d/MariaDB.repo with new content. You can generate your config file here:

Execute in endless loop shell command on Linux

Sometimes we need to execute in endless loop a command on Linux servers. For example in our case we needed to execute php script jobs.php in endless loop until I press Ctrl+C Here is how we did it with one command(BTW: in the same way it works also on Mac computers or Cygwin shell on Windows): while true; do php jobs.php; done

How to scan your server for viruses and malware

There aremanyoptions how to scan your server for viruses or malware. One of them is clamv software. 1. Here is how to install it e.g. on Centos: yum install clamav clamd 2. Than refresh the virus database with command: freshclam you can schedule this command ascron task to update virus database periodically 3. To scan whole server for viruses execute command: ionice -c3 nice -n 19 /usr/bin/clamscan -r --bell -i / ionice and nice we used to minimize impact of scanning on other applications run...

Migrate MySQL Database with Myisam engine to MariaDB Galera Cluster

Recently we have been facing higher load on our mysql servers and we decided to migrate our databases to Galera cluster based on MariaDB. One of the restriction with Galera Cluster is, that it doesn't support MyISAM tables, just InnoDB engine is supported for master-master synchronization. So here is a easy way how to migrate Mysql database with MyISAM tables into Galera and InnoDB: * Make sure your db schema doesn't contain FULLTEXT indexes or any other constructions, which are not supporte...

Calculate size of Mysql databases with SQL command

Here is SQL command you should use, when you need to calculate size of databases on your Mysql server directly from mysql console: SELECT table_schema "DB Name", sum( data_length + index_length ) / 1024 / 1024 "DB Size in MB", sum( data_free )/ 1024 / 1024 "Free Space in MB" FROM information_schema.TABLES GROUP BY table_schema ; Enjoy!

rm and the 'Argument list too long' error message

If you have in directory more than 1024 files and you wish to delete them all at once, for sure you got error message "Argument list too long". e.g. you did: rm -f *.log To solve this problem, pipe the names of files one by one to rm command like this: find . -name '*.log' | xargs rm -f It should be easy and still effective solution for you.

SVN not working

If SVN stops working with error: Authorization failed svn: OPTIONS of '': authorization failed: Could not authenticate to server: rejected Basic challenge ( it is possible that access to svn password file is not possible (permissions)... log in to as root cd /backup/home2/svnqual/etc ls -al total 20 drwxr-x--- 3 svnqual nobody 4096 Dec 13 08:11 . drwx--x--x ...

demo functionality check script

you need this demoLogin.php script: <?php require_once '../api/PapApi.class.php'; $session = new Gpf_Api_Session('URL_TO_DEMO/scripts/server.php'); $session->login('', 'demo'); echo $session->getSessionId(); ?> and then file in scripts: #!/bin/bash SESSID=$(php demoLogin.php) RESULT=$(wget -qO-URL_TO_DEMO/merchants/index.php?S=$SESSID | grep 'Loading application' | wc -l) if [ $RESULT -eq 0 ] ; then sleep(30) RESULT=$(wget -qO-URL_TO_DEMO/mercha...

How to identify account with highest load on your server

Often server administrators have problems to identify, which account is generating on server highest load. Here are some tips how to identify such account: First of all executetop command. You will see load on your server and processes, which use the most of the resources. If you will see, that there is too much httpd processes in same time running on your server, you can try to check which account generates so much requests by following commands. Commands will work just on servers with WHM ser...


Not all problems are related to Quality Unit products. Some problems are caused by your server environment. We will try to list here common problems and solutions.

Why I'm not able to dump database and get error: File size limit exceeded ?

Your system administrator must have imposed limitation on youraccount for file size creation.. Just run ulimit command to find outfile size limitation:$ ulimit -a Example of output: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) 805696 pending signals (-i) 1024 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 stack size (kbytes, -s) 10240 c...

How to whitelist IP from server firewall

To whitelist this on the other servers you can run the command: apf -a It will first need to be removed from the deny list first if it is being blocked. To remove the entry: Run this command nano /etc/apf/deny_hosts.rules Press control w to start a search, then enter the IP Once you find the location remove the two lines that the IP consist of, then exit and save the file with control x and then y to save and exit. After this run the command to restart the fi...