ftp – sync data from remote ftp server


To sync data from remote ftp server install ncftp with following command:

apt-get install ncftp

Now use following command to sync data from remote ftp server:

ncftpget -R -T -v -u userName -p 'password' ftp_hostname "directoryPathInFtpServer" "directoryPathInLocalMachine"


Gitlab backup


To backup Gitlab data use following command:

gitlab-rake gitlab:backup:create

This command will backup backup date in  path /var/opt/gitlab/backups/

To exclude any directories from backup use following command:

gitlab-rake gitlab:backup:create SKIP = db,uploads

Above command will exclude db & upload directories.

Get gitlab version number from Gitlab cli


To get Gitlab & other dependent modules version numbers use the following command:

gitlab-rake gitlab:env:info

The output will include all details like Gitlab version, git version, git shell version, OS version, Ruby version, Gem version, Bundler version, Rake version, Redis version, Sidekiq version & etc…

Gitlab with non-standerd ssh port


To user non standerd ssh port with gitlab use following procedure:

Open /etc/gitlab/gitlab.rb and add following line:

gitlab_rails['gitlab_shell_ssh_port'] = 4321

where 4321 is ssh port.

Make sure that you enabled this port in /etc/ssh/sshd_config.

Reconfigure & restart gitlab-ctl with following commands

gitlab-ctl restart

gitlab-ctl restart

Ubuntu 16.04 – Persisting IPTABLE Rules


To persist iptable rules installs iptables-persistent module.

sudo apt-get install iptables-persistent

Now you make changes to iptables & run following command to persist them:

sudo netfilter-persistent save
sudo netfilter-persistent reload

To view saved rules check in directory /etc/iptables/

Nginx – Deploy SSL certificate


These steps are used to to deploy SSL certificate issued by digicert.

Before starting make sure that you download ssl certificate issued by digicert.

Now create single file by concatenating  your_domain_com.crt and DigiCertCA.crt, name it as chained.crt

You can use following command to generate chained.crt

$ cat your_domain_com.crt DigiCertCA.crt > chained.crt

chained.crt file is used as ssl_certificate in nginx in this case.

Now configure nginx virtual hosts file for the website you wanted to secure as shown below:

server {

 listen 443 ssl default_server;
 ssl_certificate    /etc/nginx/ssl/chained.crt
 ssl_certificate_key    /etc/nginx/ssl/your_domain_name.key;

 server_name your.domain.com;

 access_log /var/log/nginx/access.log;
 error_log /var/log/nginx/error.log;

 location / {
  root   /home/www/public_html/your.domain.com/public/;
  index  index.html;


Finally restart nginx.


$ service nginx restart

After restarting your website can be accessed with https.

Hadoop High Availability – FATAL ha.ZKFailoverController: Unable to start failover controller. Parent znode does not exist


Recently on working hadoop (version 2.5.1) cluster we got this issue while starting ZookeepreFailOverController(zkfc).

After debugging we found its due to missing/corrupted parent znode in zookeepre cluster.

This fix this we have used following command:

$ bin/hdfs zkfc -formatZK


We ran this command before starting hdfs.

After formating, zkfc started and everything started working smoothly.

vim – set tab space


To change tab space width to 4 spaces add following code in /etc/vim/vimrc file

filetype plugin indent on
"to show existing tab with 4 spaces width
set tabstop=4
"when indenting with '>', use 4 spaces width
set shiftwidth=4
"On pressing tab, insert 4 spaces
set expandtab

This will convert all existing tabs to 4 spaces width & also all new tabs with 4 spaces width.