๐Ÿ“ŒMongo setup:

๐Ÿ“๐Ÿ“Prepare directories for mongo installation:

df -h

[svc_mongo01@poratestvm var]$ df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             2.1G     0  2.1G   0% /dev

tmpfs                2.1G     0  2.1G   0% /dev/shm

tmpfs                2.1G  9.9M  2.1G   1% /run

tmpfs                2.1G     0  2.1G   0% /sys/fs/cgroup

/dev/mapper/ol-root   24G  8.6G   15G  37% /

/dev/sda1            4.7G  408M  4.3G   9% /boot

/dev/mapper/ol-data   43G   20G   24G  46% /data

/dev/mapper/ol-tmp   4.7G   33M  4.7G   1% /tmp

tmpfs                423M     0  423M   0% /run/user/54321

tmpfs                423M   56K  423M   1% /run/user/0

tmpfs                423M     0  423M   0% /run/user/54324

tmpfs                423M     0  423M   0% /run/user/54325


๐Ÿ“๐Ÿ“ Use the directory have enough space.

cd /data

sudo mkdir mongodbdata


cd /etc  -- all configfiles 

sudo mkdir mongodata


cd /data

๐Ÿ“๐Ÿ“service account creation

sudo useradd svc_mongo01

sudo groupadd mongodbgp

sudo usermod svc_mongo01 -g mongodbgp

sudo passwd svc_mongo01

sudo chown svc_mongo01:mongodbgp mongodbdata


cd /etc

sudo chown svc_mongo01:mongodbgp mongodata


๐Ÿ“๐Ÿ“Login with serviceaccount svc_mongo01

cd /data

cd mongodbdata

mkdir data log setup


cat /etc/redhat-release -check os version


sudo service network restart -restart network service


cd setup

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.2.25.tgz

tar -xvf 

cd cd mongodb-linux-x86_64-rhel70-4.2.25

cd bin


๐Ÿ“๐Ÿ“Preparing environment variable 

๐Ÿ“Go to the admin account

cd /etc/profile.d/

echo $PATH  --check existing environment variables

export PATH /data/mongodbdata/setup/mongodb-linux-x86_64-rhel70-4.2.25/bin:$PATH


sudo vi mongodb.sh

export PATH=/data/mongodbdata/setup/mongodb-linux-x86_64-rhel70-4.2.25/bin:$PATH

save it


๐Ÿ“restart the session


echo $PATH

mongo --version


๐Ÿ“Prepare config (VHML) file for mongodb server to run in the background:

cd /etc/mongodata

vi mongodb.conf

๐Ÿ“Copy below lines and save it 

systemLog:

 destination: file

 path: "/etc/mongodata/mongodb.log"

 logAppend: true

storage:

 dbPath: /data/mongodbdata/data

 directoryPerDB: true

processManagement:

 fork: true

net:

 bindIp: 0.0.0.0

 port: 27017


mongod -f /etc/mongodata/mongodb.conf

๐Ÿ“ mongo  --connect mongoservice

๐Ÿ“ show dbs  --list of databases


No comments:

Post a Comment

Index