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.

Advertisements

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.

Quick way to add swap – Ubuntu

 

One of the quickest way to avoid out of memory errors is by adding some swap space. Swap is an area on hard drive where operating system can temporally store data that it can no longer hold in RAM.

Use following way to add additional swap space in Ubuntu:

First check about swap space with free command:

free -m

Lets say if we need 10GB of swap, for this first create a 10GB file with following command:

sudo fallocate -l 10G /swapfile

View details about created swapfile:

ls -hl /swapfile

Output:

-rw-r–r– 1 root root 10G May 19 06:54 /swapfile

Change permissions of swapfile:

sudo chmod 600 /swapfile

Set swap space with following command:

sudo mkswap /swapfile

Check for new swap space:

sudo swapon -s

Output:

Filename                Type        Size    Used    Priority
/swapfile                               file        10485756    2700    -2

Make swap file permanent by adding it in /etc/fstab

/swapfile none swap sw 0 0