Friday, August 2, 2019

MongoDB install on Centos using tgz/tarball

HI There,

You can download your desired Mongodb version from mongodb download section.

https://www.mongodb.com/download-center/charts

In my case i have downloaded 3.6

create the directories manually and change the permission, you need to create data directory, logfile directory and your binary location.

In my case,

mkdir -p data  -- for data dir
mkdir -p log_db_01 -- for logfile
touch /home/mongod/log_db_01/mongodb.log -- create logfile
mkdir -p mongodb_3.6 -- for binaries

change the ownership to mongod:mongod

unzip the tgz file

$ tar -zxvf mongodb-linux-x86_64-rhel70-3.6.13.tgz -C /home/mongod/

you can see a folder names mongodb-linux-x86_64-rhel70-3.6.13, you can rename it as you want.

Use below command to start mongod in background
mongod --dbpath /home/mongod/data/ --port 12345 --logpath /home/mongod/log_db_01/mongodb.log --logappend --fork


connect to mongo shell

 mongo --port 12345

MongoDB shell version v3.6.13
connecting to: mongodb://127.0.0.1:12345/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("cb0b3e73-6715-48f2-a621-91aed6e5f5ba") }
MongoDB server version: 3.6.13
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings:
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-08-02T10:22:51.758+0000 I CONTROL  [initandlisten]
>
>



Thanks


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home