GlusterFS

commands

sudo yum install centos-release-gluster312.noarch
sudo yum install glusterfs gluster-cli glusterfs-libs glusterfs-server
sudo mkdir /home/glusterfs
sudo chown <user>:<user group> /home/glusterfs
sudo gluster peer probe swarm-manager01.yourdomain.com
sudo service enable gluster.service
sudo systemctl enable gluster.service
sudo systemctl enable glusterd.service
sudo systemctl start glusterd
sudo systemctl status glusterd
sudo systemctl enable glusterd.service
sudo systemctl start glusterd.service
sudo gluster peer probe swarm-manager02.yourdomain.com
sudo gluster peer probe swarm-manager03.yourdomain.com
sudo gluster peer probe swarm-manager01.yourdomain.com
sudo gluster peer probe swarm-node01.yourdomain.com
sudo gluster peer probe swarm-node02.yourdomain.com
sudo gluster peer probe swarm-worker02.yourdomain.com
sudo gluster peer probe swarm-worker01.yourdomain.com
sudo gluster peer status
gluster volume create gfs replica 3 swarm-manager01.yourdomain.com:/home/glusterfs swarm-manager02.yourdomain.com:/home/glusterfs swarm-worker01.yourdomain.com:/home/glusterfs gluster volume create gfs replica 5 swarm-manager01.yourdomain.com:/home/glusterfs swarm-manager02.yourdomain.com:/home/glusterfs swarm-worker01.yourdomain.com:/home/glusterfs \
sudo gluster volume create gfs replica 5 swarm-manager01.yourdomain.com:/home/glusterfs swarm-manager02.yourdomain.com:/home/glusterfs swarm-worker01.yourdomain.com:/home/glusterfs swarm-worker02.yourdomain.com:/home/glusterfs
sudo gluster volume create gfs replica 3 swarm-manager01.yourdomain.com:/home/glusterfs swarm-manager02.yourdomain.com:/home/glusterfs swarm-worker01.yourdomain.com:/home/glusterfs swarm-worker02.yourdomain.com:/home/glusterfs
sudo gluster volume create gfs replica 5 swarm-manager03.yourdomain.com/home/glusterfs swarm-manager01.yourdomain.com:/home/glusterfs swarm-manager02.yourdomain.com:/home/glusterfs swarm-worker01.yourdomain.com:/home/glusterfs swarm-worker02.yourdomain.com:/home/glusterfs
mkdir -p /home/glusterfs/1/brick
sudo gluster volume create gfs replica 5 swarm-manager03.yourdomain.com/home/glusterfs/1/brick swarm-manager01.yourdomain.com:/home/glusterfs/3/brick swarm-manager02.yourdomain.com:/home/glusterfs/2/brick swarm-worker01.yourdomain.com:/home/glusterfs/4/brick swarm-worker02.yourdomain.com:/home/glusterfs/brick
sudo gluster volume create gfs replica 5 swarm-manager03.yourdomain.com:/home/glusterfs/1/brick swarm-manager01.yourdomain.com:/home/glusterfs/3/brick swarm-manager02.yourdomain.com:/home/glusterfs/2/brick swarm-worker01.yourdomain.com:/home/glusterfs/4/brick swarm-worker02.yourdomain.com:/home/glusterfs/brick
sudo gluster volume create gfs replica 5 swarm-manager03.yourdomain.com:/home/glusterfs/1/brick swarm-manager01.yourdomain.com:/home/glusterfs/3/brick swarm-manager02.yourdomain.com:/home/glusterfs/2/brick swarm-worker01.yourdomain.com:/home/glusterfs/4/brick swarm-worker02.yourdomain.com:/home/glusterfs/brick
sudo gluster volume create gfs replica 5 swarm-manager03.yourdomain.com:/home/glusterfs/1/brick swarm-manager01.yourdomain.com:/home/glusterfs/3/brick swarm-manager02.yourdomain.com:/home/glusterfs/2/brick swarm-worker01.yourdomain.com:/home/glusterfs/4/brick swarm-worker02.yourdomain.com:/home/glusterfs/brick force
sudo gluster list
sudo gluster volume list
sudo gluster start gfs
sudo gluster volume start gfs
sudo gluster volume status gfs
Read More

Apache Proxy Balancer

Enable proxy models

sudo a2enmod proxy_html
sudo a2enmod proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod proxy_ajp
sudo a2enmod lbmethod_byrequests
sudo a2enmod lbmethod_bytraffic
sudo a2enmod lbmethod_bybusyness
sudo a2enmod lbmethod_heartbeat
Read More

Create a MongoDB Replica Set

Create 3 mongodb servers. Make sure update hosts files on all nodes or on DNS server

192.168.1.10 mongodb01
192.168.1.11 mongodb02
192.168.1.12 mongodb03
Read More

Backup LXD Container as Tarball

Backup

lxc snapshot <container name> backup
lxc publish <container name>/backup --alias <container name>-backup
lxc image export <container name>-backup lxd_<container name>_tarball
lxc image delete <container name>-backup
lxc delete <container name>/backup
Read More

Volatile Variable in Java

What is volatitle variable?

volatile variable in Java is a special variable which is used to signal threads, a compiler that this particular variables value are going to updated by multiple threads.

  1. Variable’s value is always read from main memory instead of cached value.
  2. Volatile variable guarantees “happens-before” relationship, which means not only another thread has visibility of latest value of volatile variable but also all the variable is seen by the thread which has updated value of volatile variable before these thread sees it.
Read More