https://docs.mongodb.com/manual/tutorial/getting-started/
7. mongod 설치 (CentOS 기준)
확인
service mongod status
mongo --version
설치
yum install mongodb mongodb-server
시작
systemctl start mongod
systemctl status mongod
[root@localhost mosquitto]# mongo --version
MongoDB shell version: 2.6.12
[root@localhost mosquitto]# netstat -ntlp | grep mongod
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 26060/mongod
[root@localhost mosquitto]# mongo
MongoDB shell version: 2.6.12
connecting to: test
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:
2018-07-05T15:21:20.756+0900 [initandlisten]
2018-07-05T15:21:20.756+0900 [initandlisten] ** WARNING: Readahead for /var/lib/mongodb is set to 4096KB
2018-07-05T15:21:20.756+0900 [initandlisten] ** We suggest setting it to 256KB (512 sectors) or less
2018-07-05T15:21:20.756+0900 [initandlisten] ** http://dochub.mongodb.org/core/readahead
> show dbs
admin (empty)
local 0.078GB
> exit
bye
[root@localhost mosquitto]#
외부 접속
vi /etc/mongod.conf
bind_ip = 127.0.0.1 => 0.0.0.0
재시작
설치 완료
테스트해보기
[root@localhost mosquitto]# mongo
insert
> db.users.insert({_id:"terry",city:"seoul"})
Select
> db.users.find({_id:"terry"})
Delete
> db.users.remove({_id:"terry"})
속성 확인
db.users.validate()
7. mongod 설치 (CentOS 기준)
확인
service mongod status
mongo --version
설치
yum install mongodb mongodb-server
시작
systemctl start mongod
systemctl status mongod
[root@localhost mosquitto]# mongo --version
MongoDB shell version: 2.6.12
[root@localhost mosquitto]# netstat -ntlp | grep mongod
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 26060/mongod
[root@localhost mosquitto]# mongo
MongoDB shell version: 2.6.12
connecting to: test
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:
2018-07-05T15:21:20.756+0900 [initandlisten]
2018-07-05T15:21:20.756+0900 [initandlisten] ** WARNING: Readahead for /var/lib/mongodb is set to 4096KB
2018-07-05T15:21:20.756+0900 [initandlisten] ** We suggest setting it to 256KB (512 sectors) or less
2018-07-05T15:21:20.756+0900 [initandlisten] ** http://dochub.mongodb.org/core/readahead
> show dbs
admin (empty)
local 0.078GB
> exit
bye
[root@localhost mosquitto]#
외부 접속
vi /etc/mongod.conf
bind_ip = 127.0.0.1 => 0.0.0.0
재시작
설치 완료
테스트해보기
[root@localhost mosquitto]# mongo
insert
> db.users.insert({_id:"terry",city:"seoul"})
Select
> db.users.find({_id:"terry"})
Delete
> db.users.remove({_id:"terry"})
속성 확인
db.users.validate()
댓글
댓글 쓰기