Monday, July 3, 2017

Convert Text file into pdf on Linux command line

Create a small size pdf file from a text file

First install enscript on linux system.

Debian/Ubuntu
apt-get install enscript


CentOS/Fedora
yum install enscript


Command to convert text file into pdf
enscript -B /path/of/text-file.txt -o - | ps2pdf - "/path/of/output.pdf"

-B is for not printing header on top of the pdf pages

Thursday, June 8, 2017

Mongodb secondary database - database list and collection is not visible

MongoDB secondary replica does not have collections as in primary

Error : 
"$err" : "not master and slaveOk=false", "code" : 13435

Solution :
serverdb:SECONDARY> rs.slaveOk()

Running Command rs.slaveOk() on secondary instance is the solution.

Thursday, May 18, 2017

Mysql installation conflict with mariadb

Error :
Renaming removed key_buffer and myisam-recover options (if present)


mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server


Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11


dpkg: error processing package mysql-server-5.7 (--configure):subprocess installed post-installation script returned error exit status 1


Errors were encountered while processing:mysql-server-5.7


Solution :
If you have installed MariaDB and then you have removed it to install mysql. This can be the cause of this issue. If you try to purge all old config filess and set everything up from scratch then it should work. 

Take Back up your important data before doing it.

# sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
# sudo apt update 
# sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
# sudo apt install mysql-server