In Database by Debian User 8 days ago 0 Comment

In a MySQL master-slave replication setup, if relay log files corrupted on the slave server's filesystem replication status becomes as:

  • Slave_IO_Running    => Yes
  • Slave_SQL_Running => No
  • Last_SQL_Errno       => 1594

If you have the same problem you can fix the replication with following steps:

  1. Check the slave status output and save the values of Relay_Master_Log_File and Exec_Master_Log_Pos variables:

      Relay_Master_Log_File: mysql-bin.000278
        Exec_Master_Log_Pos: 58392316

  2. After that stop the slave node:


  3. Reset replication (removes all the binlogs after the replication stop point)


  4. Change the master_log_file and master_log_pos variables of current replication setup with the values you save on first step like that:

    > CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000278', MASTER_LOG_POS=58392316;

  5. Start the replication again:


Everything should be ok.

In Database by Debian User 18 days ago 0 Comment

When you want to start multiple MySQL instance on the same server or you already have some other services which also heavily depends on asynchronous io framework in Linux, you may get following error on MySQL startup:

InnoDB: Warning: io_setup() failed with EAGAIN

There are two ways to fix this problem.

First solution is you can disable native asynchronous io support in InnoDB storage engine with putting following configuration in [mysqld] section of your my.cnf file:

innodb_use_native_aio = 0

But you will also loose some performance because of the aio disabled.

Second solution is, you can increase the maximum number of asynchronous request limit in kernel. Most distributions use default value of 65536 which you can see with following command:

cat /proc/sys/fs/aio-max-nr

You can set this number to 500000 or even more with:

echo 500000 > /proc/sys/fs/aio-max-nr

or it is better to make changes permanent with adding following lines to /etc/sysctl.conf or /etc/sysctl.d/XXX.conf file:

fs.aio-max-nr = 500000

Tags: mysql aio innodb
In Tools by Turker Sezer about 1 month ago 0 Comment

Rygel is the one of the most popular DLNA softwares on Linux. It is a home media solution that allows you to easily share audio, video and pictures to other devices.

Rygel configuration is very simple except two tricky points. If you can't see all folders which you shared, follow instructions below.

Before we start to share our media files over network using rygel, we have to edit few lines in config file. Rygel config file is in ~/.config/rygel.conf path.

  • Select Folders to Share

We will list all folder names which we want to share as semicolon-seperated in uris parameter in [MediaExport] section. We don't need to escape special characters or spaces.

uris=/mnt/D/sample-folder/NEW;/mnt/D/sample folder/Videos;

  • Disable Tracker Plugin
Rygel disables MediaExport plugin which we use to share user-selected folders if Tracker plugin is enabled. So you can see only default pictures, videos and music folders as shared instead of user-defined folders. To disable Tracker plugin, we will change enabled parameter in [Tracker] section as False.


Now we can run rygel command, and access all shared folders from other devices.

In Networking by Murat Demirten about 1 month ago 0 Comment

If you have a delay about 10-15 seconds when mounting shared NFS folders, check logfiles (/var/log/syslog, /var/log/messages) for a log like this:

RPC: AUTH_GSS upcall timed out

If you can see similar logs, your nfs mounts delayed by the Kerberos authentication on server side. If your NFS server in a network which needs Kerberos authentication, you have to set NEED_GSSD=yes in /etc/default/nfs-common file. After reboot, mount delays will be disappear.

But, most of the time you're not in a Kerberos enabled network or you don't need Kerberos authentication mechanism in your NFS server. If so, you have to blacklist rpcsec_gss_krb5 Linux kernel module. To do this create a file named /etc/modprobe.d/blacklist-nfs-gss.conf and add following line into that file:

blacklist rpcsec_gss_krb5

After reboot, you can mount without any delays.

Tags: nfs rpc
In Filesystem by Turker Sezer about 1 month ago 0 Comment

We can browse and mount Windows shared folders from Linux machines. We can also use same methods to access SMB shares from Linux servers.

Most of Linux distros include smbfs package as default. This package contains smb related commands.

To get a list of shares on a server, run,

/usr/bin/smbclient -L <server>

'server' parameter will be IP address or hostname of server. This command will return a list of services which contains shared drives and printers. If smb shares have security configured, that command will ask for a password.

To use a share on client machine, run,

/usr/bin/smbclient <service> <password>

'service' will be hostname and share name. For example, if you want to access 'images' directory on 'johndoe' server, service would be called \\johndoe\\images. But, due to shell restrictions, you need to escape backslashes, so you should use that command,

/usr/bin/smbclient \\\\johndoe\\\\images yourpassword

When you run that command, you will access to smbclient prompt. If you type 'h', you can see all available commands.

smb: \> h
ls             dir            lcd            cd             pwd           
get            mget           put            mput           rename        
more           mask           del            rm             mkdir         
md             rmdir          rd             prompt         recurse       
translate      lowercase      print          printmode      queue         
cancel         stat           quit           q              exit          
newer          archive        tar            blocksize      tarmode       
setmode        help           ?              !

If you are familiar with ftp command, you can use smbclient prompt easily.

smbclient prompt is good for testing but it isn't enough for real work. Probably, you will want to mount smb shares to your local and use them like a standard folder. So you should use smbmount and smbumount commands for that. These commands work like mount and umount commands.

To mount a smb share to your system, run,

smbmount "\\\\johndoe\\\\images" -U <username> -c 'mount /target_folder -u 500 -g 100'

We use same 'service' parameter in that command. And we also specify target folder name to mount share to that folder. After you run that command, you will see smb share as mounted in mount command output like a NFS share.

[root@myhost]# mount
/dev/hda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,mode=622)
//JOHNDOE/IMAGES on /target_folder type smbfs (0)

In Administration by Debian User about 1 month ago 0 Comment

You may receive this errors on Linux systems in several programs specifically on installation on service setup step.

Most common reason for this problem, if your fully qualified domain name does not include any . (dot) character, software used to setup the service thinks that your hostname is not set properly.

If following command returns a hostname with dot(s), this makes setup software happy:

$ hostname --fqdn

As you can see, it doesn't return a dotted hostname. We can solve this problem with adding a dotted hostname in /etc/hosts file like below:    myserver.localhost  myserver

You can provide more than one hostname for ip but the first entry must be a dotted version.

After that run the command again:

$ hostname --fqdn

It probably solves your problem.

Please check hostname related articles below.

Tags: hostname fqdn
In Database by Turker Sezer 2 months ago 0 Comment

We use mysqldump command to get database backups or move data between servers. mysqldump command generates backups in SQL format.

On contrary of backup process, you don't need to use a special command to import backups files back into mysql. 

If you didn't create database before and your backup file doesn't contain 'CREATE DATABASE' command, you have to create database first,

mysqladmin -u username -p create database_name

Then you can use one of the following commands to import your SQL-formatted backups.

Option 1

mysql -u username -p database_name < backup_file.sql

Option 2

cat backup_file.sql | mysql -u username -p database_name

Option 3

mysql -u username -p database_name
source backup_file.sql

If you use gzip to compress backup files, you have to use zcat command instead of cat command

zcat backup_file.sql.gz | mysql -u username -p database_name

It is common to use ssh keys for deployments on the server. But most of the time you have to setup a new ssh key for each server and these keys doesn't have passphrase for private key to make deployments easy.

Maintaining ssh keys for servers takes time and storing these keys on the server side can be security problem.

Using ssh agent forwarding, you can solve all the problems above. It allows you to use your local SSH keys instead of keys on your server.

This process provided by ssh-agent, which runs in the background and keeps your key loaded into memory, so that you don’t need to enter your passphrase every time you need to use the key. Another feature is you can choose to let servers access your local ssh-agent as if they were already running on the server.

Example: Assume that users john wants to deploy on remote-server with their local ssh keys. To do this first add local ssh keys to local ssh-agent:


After that, give -A command line option when connecting to remote-server:

ssh -A remote-user@remote-server

Now you can make deployments on the server with your local keys.

See also: man ssh-agent, man ssh-add