Centos6.5 安装mongo3.4

感觉忘了好多东西,记录一下。

安装包 mongodb-linux-x86_64-rhel62-3.4.2.tgz

/**  目录/home  **/

[root@slave02 ~]# cd /home

[root@slave02 home]# tar zxvfmongodb-linux-x86_64-rhel62-3.4.2.tgz

mongodb-linux-x86_64-rhel62-3.4.2/README

mongodb-linux-x86_64-rhel62-3.4.2/THIRD-PARTY-NOTICES

mongodb-linux-x86_64-rhel62-3.4.2/MPL-2

mongodb-linux-x86_64-rhel62-3.4.2/GNU-AGPL-3.0

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongodump

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongorestore

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongoexport

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongoimport

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongostat

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongotop

mongodb-linux-x86_64-rhel62-3.4.2/bin/bsondump

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongofiles

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongooplog

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongoreplay

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongoperf

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongod

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongos

mongodb-linux-x86_64-rhel62-3.4.2/bin/mongo

 

gzip: stdin: decompression OK, trailinggarbage ignored

tar: Child returned status 2

tar: Error is not recoverable: exiting now

 

/** 重命名 **/

[root@slave02 home]# mv  mongodb-linux-x86_64-rhel62-3.4.2 mongodb

 

/** 进入mongodb目录 **/

[root@slave02 home]# cd mongodb

 

/** 创建db和日志目录 **/

[root@slave02 mongodb]# mkdir/home/mongodb/data

[root@slave02 mongodb]# mkdir/home/mongodb/data/db

[root@slave02 mongodb]# mkdir /home/mongodb/data/logs

 

/** logs目录下创建mongodb.log文件 **/

[root@slave02 mongodb]# cd data/logs

[root@slave02 logs]# touch mongodb.log

 

 

/** mongodb/data目中创建mongodb.conf **/

[root@slave02 logs]# cd /home/mongodb/data

[root@slave02 data]# vi mongodb.conf

 

/** 加入相关配置mongodb.conf **/

#端口号

port = 27017

#数据目录

dbpath = /home/mongodb/data/db

#日志目录

logpath = /home/mongodb/data/logs/mongodb.log

#设置后台运行

fork = true

journal=true #启用日志文件,默认启用  

#日志输出方式

logappend = true

#开启认证

#auth = true

bind_ip =192.168.2.30

/** esc :wq 保存退出 **/

运行

[root@slave02 data]# cd /home/mongodb/bin

[root@slave02 bin]# chmod 777 *

 [root@slave02 bin]# ./mongod --config/home/mongodb/data/mongodb.conf

about to fork child process, waiting untilserver is ready for connections.

forked process: 48643

child process started successfully, parentexiting

[root@slave02 bin]#

 

 

 

添加开机脚本

/** 进入init.d目录 **/

[root@slave01 ~]# cd /etc/init.d

/** /etc/init.d中添加mongod脚本 **/

/** 权限赋予**/

[root@slave01 init.d]# chmod 777/etc/init.d/mongod

/** 增加服务**/

[root@slave01 init.d]# chkconfig --addmongod

/** 启动关闭测试**/

[root@slave01 init.d]# service mongod stop                                    [确定]

 

[root@slave01 init.d]# service mongod start

Starting mongod: about to fork childprocess, waiting until server is ready for connections.

forked process: 18211

child process started successfully, parentexiting

[确定]

 

[root@slave01 init.d]# service mongodstatus

mongod (pid 18211) 正在运行...

[root@slave01 init.d]#

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值