Thursday, August 23, 2018

How to connect to MongoDB Server

How to connect to MongoDB:


run .bash_profile file from mongodb user account then run mongod command to initialize the mongodb service 

[mdashok@mongodb4 bin]$ mongod
2018-08-23T09:56:30.370+0530 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] MongoDB starting : pid=3843 port=27017 dbpath=/data/db 64-bit host=mongodb4
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] db version v4.0.0
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] modules: enterprise
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] build environment:
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten]     distmod: rhel62
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-23T09:56:30.579+0530 I CONTROL  [initandlisten] options: {}
2018-08-23T09:56:30.613+0530 W STORAGE  [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-08-23T09:56:30.671+0530 W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten]
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-08-23T09:56:30.672+0530 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1355M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-08-23T09:56:31.659+0530 I STORAGE  [initandlisten] WiredTiger message [1534998391:659516][3843:0x7f4a80b14a80], txn-recover: Main recovery loop: starting at 2/5504
2018-08-23T09:56:31.659+0530 I STORAGE  [initandlisten] WiredTiger message [1534998391:659801][3843:0x7f4a80b14a80], txn-recover: Recovering log 2 through 3
2018-08-23T09:56:31.711+0530 I STORAGE  [initandlisten] WiredTiger message [1534998391:711621][3843:0x7f4a80b14a80], txn-recover: Recovering log 3 through 3
2018-08-23T09:56:31.753+0530 I STORAGE  [initandlisten] WiredTiger message [1534998391:753249][3843:0x7f4a80b14a80], txn-recover: Set global recovery timestamp: 0
2018-08-23T09:56:31.818+0530 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:32.047+0530 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-08-23T09:56:32.061+0530 I NETWORK  [initandlisten] waiting for connections on port 27017


Open new session then run "mongo" command :-

[mdashok@mongodb4 ~]$ . .bash_profile
[mdashok@mongodb4 ~]$ mongo
MongoDB shell version v4.0.0
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.0.0
Server has startup warnings:
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten]
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-08-23T09:56:30.671+0530 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-08-23T09:56:31.865+0530 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-08-23T09:56:31.866+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-08-23T09:56:31.867+0530 I CONTROL  [initandlisten]
MongoDB Enterprise > show dbs
admin   0.000GB
config  0.000GB
local   0.000GB

Step by Step YugabyteDB 2.11 (Open Source) Distributed DB - Multi-node Cluster Setup on RHEL

Scope - ·        Infrastructure planning and requirement for installation of the multi-node cluster database ·        Prerequisites Software...