Pages

Welcome to My Blog

This is to share my IT experience with friends all around the world.
I have been working in Linux Fedora Systems for more than 8 years. Its fun to share knowledge and learn..
As everyone knows when a problem arises in your systems "googling" is the way that many depend on..

All the posts here are my working experiences during my working life.. So you can count on it..

I have added the references where I got help in solving IT issues


Thursday, October 3, 2013

PHP Warning: date(): It is not safe - PHP Warning

I got this warning whenever my site was accessed. It is just a warning but error log is filled.I searched in the Internet and identified it can be simply rectified by changing the configurations at php.ini

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

By default it was commented and I have set to my time zone as follows

date.timezone = Asia/Colombo

The correct time zone values relevant to your location are listed here
http://www.php.net/manual/en/timezones.php

Good Reference
http://www.php.net/manual/en/timezones.php

Monday, May 6, 2013

MySQL error 1236: Client requested master to start replication from impossible position

We are using MySQL replication to synchronise databases in master and slave servers.(If you want to know how to set up mysql mirroring please read How To Set Up Master Slave Replication in MySQL)

Due to power failure, two servers got rebooted and we identified the replication process has not started. The mysqld.log (/var/log/mysqld.log) showed the following error:

[ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)

We tried to identify the updates missing in the slave mysql server but due to lack of information it was not possible. The only information we got from the client's log file was the location (binary file and its position) that it tried to read from the master side. It was observed the binary log file in the master server side was somewhat newer to the location indicated in the slave server side.

Ex: Client was tried to read up to log mysqld-bin.00045 and position 234994 but the serve had the newer binary log (say mysqld-bin.00048).

After referring the several web resources, we understood these positions at the slave and master can be observed by following mysql commands;

Client side status:
mysql> show slave status;
It displays the status of the slave and importantly parameters
 Master_Log_File   | Read_Master_Log_Pos
These are the positions client tries to read from master.

In the master side using the show master status command give the current location of the master. If the locations (positions) are not the same, the synchronization fails.

What to do next?
If you can synchronise two databases manually, do it (I did it with tar zip command).
Check the position of the master with show master status and set the same position parameters at the slave server.
Use following commands to set the master server parameters at the slave server;

mysql>slave stop; 
mysql>CHANGE MASTER TO MASTER_HOST='master-database.example.com', MASTER_USER='username', MASTER_PASSWORD='password', MASTER_LOG_FILE='new_binary_log_file', MASTER_LOG_POS=new_position; 
mysql>slave start;

Check the status of the replication referring /var/log/mysqld.log and show slave status command. Check Slave_IO_Running | Slave_SQL_Running parameters of the output of the show slave status. Both these parameters should be 'Yes'.



mysql>slave stop; 
mysql>CHANGE MASTER TO MASTER_HOST='master-database.example.com', MASTER_USER='username', MASTER_PASSWORD='password', MASTER_LOG_FILE='new_binary_log_file', MASTER_LOG_POS=new_position; 
mysql>slave start;

Check the status of the replication referring /var/log/mysqld.log and show slave status command. Check Slave_IO_Running | Slave_SQL_Running parameters of the output of the show slave status. Both these parameters should be 'Yes'.

I found the following references very useful in the error detection/correction process.

http://www.brianklug.com/w/page/15052161/MySQL%20Error%3A%20Client%20requested%20master%20to%20start%20replication%20from%20impossible%20position

http://dev.kafol.net/2011/09/mysql-error-1236-client-requested.html

Wednesday, April 10, 2013

Rate Limit Horde IMP Outgoing Email

We have installed Horde Groupware 5.0.4 as the webmail application and required to limit the number of emails sent by an authoritative user through the horde IMP application. After referring several online documents, I was aware that it should be done through the Horde admin panel.

In Admin control panel, under the permissions I added a new permission to IMP and enabled all Show/Read/Write/Delete to all authenticated users and then added another child permission to IMP to set the "Maximum Number of Recipients per Time Period (max_timelimit)". The number of recipients were set to a reasonable amount as desired.


This enables the rate limiting for outgoing emails through the Horde interface.

Good Reference:
http://www.se.cuhk.edu.hk/~hmleung/wordpress/?p=1264
 

Wednesday, February 6, 2013

Use Minicom to access COM port

When we need to configure a router through console port, normally we use Hyperterminal in Windows environment. Minicom is one the alternative which can be use to do the same functionality (Access COM/Modem ports etc) in Linux environment.

Minicom is not a default application, you need to install with yum / apt-get utility.

yum install minicom

Once you install minicom, you need to configure required parameters according to your requirement. (i.e. By default minicom is trying to communicate with /dev/modem, you may need to access your COM port /dev/ttyS0, and also may need to change the communication parameters)

Start configure minicom with
minicom -s 

It will provide you a menu driven interface where you can set the required parametes;



As my requirement was to communicate with a Cisco router and I have connected it to the COM port via a console cable, I need to set the Serial port settings as follows;
After settings they need to saved as the default setting and Exit from the configuration.

The minicom will communicate with the port that you have configured and will open a communication window with user friendly environment.






Useful references:
http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html




Wednesday, January 2, 2013

Moving Drupal Site to another server

We are using dupal 7 and required to move the site from the development server to the real working server. The steps we followed were as follows;

  • Backup the folder containing the website
  • Get the mysql dump file from the development server

  • Copy the backedup folder to the website document root at working server and changed the ownership of the folder to the apache user
  • Configure apache to accept requests of the website 
    • Edit the httpd.conf and add another name based virtual host to the file with the document root and server name of the website 
  • Created the database and database user to access the database
  • Restore the  mysql dump with following command
mysql -u database_user database_name < dump_file
Restart apache

You need to update DNS of the website to the new server