Tuesday, July 30, 2019

HOT CLONE A CENTOS SERVER WITH RSYNC

Hot Clone is the term used to describe to completely clone a Linux server using r-sync across the network. This is useful in situations which you would like to create a clone with little to no downtime that would be typical of taking the original server offline. You can use this to perhaps move a single server in to a cluster environment or certain situation in which you want to upgrade or reduce drives etc.

THIS GUIDE MAKES A COUPLE ASSUMPTIONS:

First both servers need to have the same disk configuration. Either both servers use hardware raid, software raid, or single disks. They typically need to match.
The new server should have the same major install release as the source server.  So both servers would be CentOS 6.x or both need to be 7.x.
The new server has hard drive partitions in a the same format as the old server and they are either the same size or can accommodate all of the used space on the source system.
Services which are writing data should be stopped at the time of the sync (ie mail, databases etc).

PREPARE THE SYSTEMS:

Install needed software packages on both servers:
yum install -y rsync
On the server you want to copy from(want to clone) perform the following:
Create and edit /root/exclude-files.txt and add the following:
/boot
/dev
/tmp
/sys
/proc
/backup
/etc/fstab
/etc/mtab
/etc/mdadm.conf
/etc/sysconfig/network*
This excludes files which directly pertain to the source system and should not be copied to the new system.

HOT CLONE THE SERVER:

Once you have saved that file you can go ahead and rsync to the server you want to copy to:
rsync -vPa -e 'ssh -o StrictHostKeyChecking=no' --exclude-from=/root/exclude-files.txt / DESTINATIONIP:/
This will rsync over everything from the source system to the new system. The size of the drives and load on the servers will determine how long the copy will take.  Be sure to update DESTINATIONIP with the IP address or hostname of the server you are copying to.
After the rsync has completed you can reboot the freshly copied system to have it load everything that has been copied. If you were going to replace the old system with the new system and wanted the same IP addresses, host name etc to be used,  you would then remove /etc/sysconfig/network* from the exclusion file.
Once the new server is back up from the reboot. Go ahead and login using the old servers login credentials and verify everything is working as expected.

Tuesday, May 28, 2019

Active MQ Installation on Centos 7 and configuration for Mulesoft




Active MQ Installation and configuration for Mulesoft





1. Install Java on CentOS 7
   Follow the link below 

2. Install Active MQ on Centos 7
   Follow the link below 

3. sudo vi activemq.xml (add below xml config)
   
    3.1 Add the ssl on  <transportConnectors>
          
          <transportConnector name="ssl" uri="ssl://0.0.0.0:61617?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600&amp;needClientAuth=false"/>



     3.2 Add sslContext after </shutdownHooks>
           
 <sslContext>
<sslContext keyStore="file:${activemq.base}/conf/broker.ks" keyStorePassword="password"/>
</sslContext>


      3.3. Add Authentication Plugins after The <broker> element.


<plugins>
        <simpleAuthenticationPlugin>
          <users>
            <authenticationUser username="admin" password="admin" groups="admins"/>
            <authenticationUser username="mulesoft" password="mulesoft" groups="users"/>
          </users>
        </simpleAuthenticationPlugin>
        <authorizationPlugin>
            <map>
              <authorizationMap>
                <authorizationEntries>
                  <authorizationEntry queue=">" write="admins" read="admins" admin="admins"/>
                  <authorizationEntry topic=">" write="admins" read="admins" admin="admins"/>
                  <authorizationEntry queue=">" write="users" read="users"/>
                  <authorizationEntry topic=">" write="users" read="users"/>
                  <authorizationEntry topic="ActiveMQ.Advisory.>" write="users" read="users" 

admin="users"/>
                </authorizationEntries>
              </authorizationMap>
            </map>
        </authorizationPlugin>
</plugins>



    3.4 add users
           Open users.properties, add:

                mulesoft=mulesoft
    3.5 add groups
         
           Open group.properties, add:

             users=mulesoft


4.   sudo service activemq start (start active mq and enjoy !)

Friday, March 1, 2019

ElasticSearch installation on Centos 7


1. sudo vi /etc/yum.repos.d/elasticsearch.repo

2. [elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

3. 
sudo yum install elasticsearch

4. sudo systemctl start elasticsearch.service


sudo systemctl stop elasticsearch.service

To configure Elasticsearch to start automatically when the system boots up, run the following commands:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

MongoDB installation on CentOS7


Mongo DB Installation

1. vi /etc/yum.repos.d/mongodb.repo

2.

[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc
3. sudo yum install -y mongodb-org

4. sudo vi /etc/security/limits.d/99-mongodb-nproc.conf

5.vi /etc/security/limits.d/99-mongodb-nproc.conf

mongod soft nofile 64000
mongod hard nofile 64000
mongod soft nproc 64000
mongod hard nproc 64000


6. sudo systemctl start mongod

systemctl stop mongod
systemctl restart mongod
systemctl status mongod
mongod --version