Wednesday 26 October 2016

Restore the missing date Unity panel -UBUNTU

After reaching to office when I started the system in morning, time and date was not getting displayed.
The following command solved the problem for me.

  • Restart unity
    • sudo killall unity-panel-service

Resolve pg_dump version mismatch

I was getting an error of "pg_dump: server version: 9.4.7; pg_dump version: 9.3.9 ubuntu" while taking backup from server to my machine. I rectified the error using the following steps

  1. Check the version of psql and pg_dump
    1. pg_dump --version
    2. psql --version
  2. Install postgresql version 9.4
    1. cd /etc/apt/sources.list.d/
    2.  sudo vi pgdg.list
      1. Add the following line
        1. deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
    3.   wget --quiet -O - \ https://www.postgresql.org/media/keys/ACCC4CF8.asc |  sudo apt-key add -
    4.   sudo apt-get install postgresql-9.4
    5.  sudo apt-get install pgadmin3
    6. sudo /etc/init.d/postgresql restart
  3.  sudo rm /usr/bin/pg_dump
  4. sudo ln -s /usr/lib/postgresql/9.4/bin/pg_dump /usr/bin/pg_dump

References

1-http://stackoverflow.com/questions/23793774/psql-and-pg-dump-version-mismatch

Friday 12 August 2016

Solution for Arrow keys to function properly in sqlplus on Ubuntu

The arrow keys were not functioning properly in Sqlplus in Ubuntu terminal. I installed rlwrap and it worked for me by

rlwrap sqlplus

Monday 1 August 2016

Solution to PostgreSQL not starting

I installed postgresql9.5 on ubuntu 16.04, using "apt-get install" everything was running fine, until I installed MySQL.
PostgreSQL was not starting, in-spite of making all the required changes n pg_hba.conf and postgresql.cof files.

Finally I found the following solution :

1-sudo mkdir -p /usr/local/pgsql/data
2-s-udo chown -R postgres:postgres /usr/local/pgsql/

(Login as postgresql user)


3-sudo -u postgres -i
4-cd /usr/lib/postgresql/9.5/bin
5-./initdb -D /usr/local/pgsql/data
6-./postgres -D /usr/local/pgsql/data/ (Keep it running)


Thanks to https://ubuntuforums.org/showthread.php?t=869080

Tuesday 2 February 2016

Resolve the connection problem of MongoDB

I was trying to connect to mongoDB and was getting the following error :


MongoDB shell version: 2.6.11
connecting to: test
2016-02-03T10:23:22.010+0530 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-02-03T10:23:22.011+0530 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed

I resoved the above issue by issuing the following command in MongoDB


  • sudo rm /var/lib/mongodb/mongod.lock
  • sudo service mongod restart


Tuesday 26 January 2016

Covert Space delimited file to Tab delimited file

Unix has its own wonders, one of it quick help came to me, while I wanted to convert a text file in which values are separated by single space to a tab separated values. I used the following commands to convert

 sed 's/ /\t/g' filename.txt > filename.new.txt.