본문 바로가기

리눅스

[리눅스] mongoDB 소스 설치

반응형

mongoDB 소스 설치

 

mongoDB 다운로드 사이트
https://www.mongodb.com/download-center#community

 

1. mongoDB 다운로드

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.4.tgz

2. mongoDB 압축 해제

tar xvfz mongodb-linux-x86_64-rhel62-3.4.4.tgz

3. mongoDB 서브디렉토리 생성

mv mongodb-linux-x86_64-rhel62-3.4.4 /appdata/
ln -s /appdata/mongodb-linux-x86_64-rhel62-3.4.4 /appdata/mongodb
mkdir -p /appdata/mongodb/{data,config,log}

4. mongoDB config 파일 생성

vi /appdata/mongodb/config/mongodb.conf
logpath=/appdata/mongodb/log/mongod.log
logappend=true
fork=true
dbpath=/appdata/mongodb
pidfilepath=/appdata/mongodb/log/mongod.pid
bind_ip=127.0.0.1
port=27017
verbose=true
rest=true

5. mongoDB 구동

/appdata/mongodb/bin/mongod --config /appdata/mongodb/config/mongodb.conf
 /appdata/mongodb/bin/mongod --config /appdata/mongodb/config/mongodb.conf
...
2017-04-24T17:46:34.867+0900 I CONTROL  [main] ** WARNING: --rest is specified without --httpinterface,
2017-04-24T17:46:34.867+0900 I CONTROL  [main] **          enabling http interface
about to fork child process, waiting until server is ready for connections.
forked process: 1610
child process started successfully, parent exiting

6. mongoDB 접속

/appdata/mongodb/bin/mongo localhost:27017
$ /appdata/mongodb/bin/mongo localhost:27017
...
MongoDB shell version v3.4.4
connecting to: localhost:27017
MongoDB server version: 3.4.4
Server has startup warnings:
2017-04-24T17:54:24.843+0900 I CONTROL  [main] ** WARNING: --rest is specified without --httpinterface,
2017-04-24T17:54:24.843+0900 I CONTROL  [main] **          enabling http interface
2017-04-24T17:54:24.866+0900 I STORAGE  [initandlisten]
2017-04-24T17:54:24.866+0900 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-24T17:54:24.866+0900 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten]
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten]
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten]
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten]
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-04-24T17:54:25.190+0900 I CONTROL  [initandlisten]
>

 

[MongoDB 3.4.4 설치 스크립트]

vim z.sh
#!/bin/bash

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.4.tgz --no-check-certificate
tar xvfz mongodb-linux-x86_64-rhel62-3.4.4.tgz
ln -s /appdata/mongodb-linux-x86_64-rhel62-3.4.4 /appdata/mongodb
mkdir -p /appdata/mongodb/{data,config,log}

cat << 'EOF' >> /appdata/mongodb/config/mongodb.conf
logpath=/appdata/mongodb/log/mongod.log
logappend=true
fork=true
dbpath=/appdata/mongodb
pidfilepath=/appdata/mongodb/log/mongod.pid
bind_ip=127.0.0.1
port=27017
verbose=true
rest=true
EOF

/appdata/mongodb/bin/mongod --config /appdata/mongodb/config/mongodb.conf

 

728x90
반응형