반응형
Install MongoDB on or CentOS6 Linux
1. Configure the package management system (yum)
vim /etc/yum.repos.d/mongodb.repo
$ vim /etc/yum.repos.d/mongodb.repo
[mongodb-org-2.6]
name=MongoDB 2.6 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
2. Install the MongoDB packages and associated tools
yum install -y mongodb-org
3-1. Run MongoDB Community Edition
service mongod start
$ service mongod start
Starting mongod: [실패]
tail -f /var/log/mongodb/mongod.log
$ tail -f /var/log/mongodb/mongod.log
==> mongod.log <
2017-04-24T12:48:09.850+0900 ***** SERVER RESTARTED *****
2017-04-24T12:48:09.852+0900 [initandlisten] MongoDB starting : pid=1876 port=27017 dbpath=/var/lib/mongo 64-bit host=kstest01
2017-04-24T12:48:09.853+0900 [initandlisten] db version v2.6.12
2017-04-24T12:48:09.853+0900 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-04-24T12:48:09.853+0900 [initandlisten] build info: Linux build5.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-04-24T12:48:09.853+0900 [initandlisten] allocator: tcmalloc
2017-04-24T12:48:09.853+0900 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2017-04-24T12:48:09.860+0900 [initandlisten] journal dir=/var/lib/mongo/journal
2017-04-24T12:48:09.860+0900 [initandlisten] recover : no journal files present, no recovery needed
2017-04-24T12:48:09.860+0900 [initandlisten]
2017-04-24T12:48:09.860+0900 [initandlisten] ERROR: Insufficient free space for journal files
2017-04-24T12:48:09.860+0900 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
2017-04-24T12:48:09.860+0900 [initandlisten]
2017-04-24T12:48:09.860+0900 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2017-04-24T12:48:09.860+0900 [initandlisten] dbexit:
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: going to close listening sockets...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: going to flush diaglog...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: going to close sockets...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: waiting for fs preallocator...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: lock for final commit...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: final commit...
2017-04-24T12:48:09.860+0900 [initandlisten] shutdown: closing all files...
2017-04-24T12:48:09.860+0900 [initandlisten] closeAllFiles() finished
2017-04-24T12:48:09.860+0900 [initandlisten] journalCleanup...
2017-04-24T12:48:09.860+0900 [initandlisten] removeJournalFiles
2017-04-24T12:48:09.861+0900 [initandlisten] shutdown: removing fs lock...
2017-04-24T12:48:09.861+0900 [initandlisten] dbexit: really exiting now
vim /etc/mongod.conf
$ vim /etc/mongod.conf
...
smallfiles = true
...
참고 URL : https://docs.mongodb.com/manual/reference/configuration-options/#storage.mmapv1.smallFiles
3-2 Start MongoDB
$ service mongod start
Starting mongod: [ OK ]
3-3 Verify that MongoDB has started successfully
tail -f /var/log/mongodb/mongod.log
$ tail -f /var/log/mongodb/mongod.log
2017-04-24T13:00:54.810+0900 ***** SERVER RESTARTED *****
2017-04-24T13:00:54.812+0900 [initandlisten] MongoDB starting : pid=2162 port=27017 dbpath=/var/lib/mongo 64-bit host=kstest01
2017-04-24T13:00:54.812+0900 [initandlisten] db version v2.6.12
2017-04-24T13:00:54.812+0900 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-04-24T13:00:54.812+0900 [initandlisten] build info: Linux build5.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_ 64 BOOST_LIB_VERSION=1_49
2017-04-24T13:00:54.812+0900 [initandlisten] allocator: tcmalloc
2017-04-24T13:00:54.812+0900 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { for k: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo", smallFiles: true }, systemLog: { destination: "file", logAp pend: true, path: "/var/log/mongodb/mongod.log" } }
2017-04-24T13:00:54.819+0900 [initandlisten] journal dir=/var/lib/mongo/journal
2017-04-24T13:00:54.820+0900 [initandlisten] recover : no journal files present, no recovery needed
2017-04-24T13:00:54.850+0900 [initandlisten] waiting for connections on port 27017
$ netstat -nlp | grep mongod | grep -v grep
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 2162/mongod
unix 2 [ ACC ] STREAM LISTENING 12251 2162/mongod /tmp/mongodb-27017.sock
참고 URL : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
[설치 스크립트]
vim mongodb.sh
$ vim mongodb.sh
#!/bin/sh
cat << 'EOF' >> /etc/yum.repos.d/mongodb.repo
[mongodb-org-2.6]
name=MongoDB 2.6 Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
EOF
yum clean all
yum install -y mongodb-org
echo "smallfiles = true" >> /etc/mongod.conf
service mongod start
chmod 700 mongodb.sh
sh mongodb.sh
728x90
반응형
'리눅스' 카테고리의 다른 글
[Ansible ] 일반 계정 생성 (0) | 2017.04.25 |
---|---|
[리눅스] mongoDB 소스 설치 (0) | 2017.04.24 |
CentOS 7에서 방화벽을 설정하는 방법 (0) | 2017.04.20 |
[리눅스] CentOS 7 런레벨(runlevel) 변경 (0) | 2017.04.18 |
[리눅스] Ansible 일반 계정으로 배포하기 (0) | 2017.04.16 |