ChatterBot之linux下安装mongodb 02

当前环境 :centos 6.9 

mongodb版本 mongodb-linux-x86_64-3.4.4.tgz 

使用链接工具:studio-3t-x64.msi.zip

首先我们先来安装mongodb:

1.把下载好的mongodb-linux-x86_64-3.4.4.tgz  放在opc下面
2.解压到当前路径;

3.在根目录下新建data/db两个文件夹,这是mongodb数据文件默认的存放位置.

1 mkdir -p /data/db

4.命令行中运行 MongoDB 服务

 你可以再命令行中执行mongo安装目录中的bin目录执行mongod命令来启动mongdb服务。

 注意:如果你的数据库目录不是/data/db,可以通过 --dbpath 来指定。

 下面这些是服务.

[root@localhost /]# cd /opt/mongodb-linux-x86_64-3.4.4/bin
[root@localhost bin]# ll
total 232816
-rwxr-xr-x. 1 root root  4769592 Apr 20  2017 bsondump
-rwxr-xr-x. 1 root root 29404312 Apr 20  2017 mongo
-rwxr-xr-x. 1 root root 53966552 Apr 20  2017 mongod   //启动
-rwxr-xr-x. 1 root root  8520309 Apr 20  2017 mongodump
-rwxr-xr-x. 1 root root  6491029 Apr 20  2017 mongoexport
-rwxr-xr-x. 1 root root  6345814 Apr 20  2017 mongofiles
-rwxr-xr-x. 1 root root  6641732 Apr 20  2017 mongoimport
-rwxr-xr-x. 1 root root  6118188 Apr 20  2017 mongooplog
-rwxr-xr-x. 1 root root 53347992 Apr 20  2017 mongoperf
-rwxr-xr-x. 1 root root  9678815 Apr 20  2017 mongoreplay
-rwxr-xr-x. 1 root root  9935423 Apr 20  2017 mongorestore
-rwxr-xr-x. 1 root root 30122568 Apr 20  2017 mongos
-rwxr-xr-x. 1 root root  6707676 Apr 20  2017 mongostat
-rwxr-xr-x. 1 root root  6324847 Apr 20  2017 mongotop  //停止

 5.使用[root@localhost bin]# ./mongod   来启动服务(在第一次安装时会吧/data/db下需要的数据库文件生成出来);

 1 [root@localhost bin]# ./mongod              //启动
 2 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] MongoDB starting : pid=3289 port=27017 dbpath=/data/db 64-bit host=localhost.localdomain
 3 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] db version v3.4.4
 4 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] git version: 888390515874a9debd1b6c5d36559ca86b44babd
 5 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] allocator: tcmalloc
 6 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] modules: none
 7 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] build environment:
 8 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten]     distarch: x86_64
 9 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten]     target_arch: x86_64
10 2017-11-28T23:47:58.383-0800 I CONTROL  [initandlisten] options: {}
11 2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] 
12 2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
13 2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
14 2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,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),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
15 2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] 
16 2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
17 2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
18 2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
19 2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] 
20 2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] 
21 2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
22 2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
23 2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] 
24 2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
25 2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
26 2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] 
27 2017-11-28T23:47:59.339-0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
28 2017-11-28T23:47:59.435-0800 I INDEX    [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
29 2017-11-28T23:47:59.435-0800 I INDEX    [initandlisten]      building index using bulk method; build may temporarily use up to 500 megabytes of RAM
30 2017-11-28T23:47:59.436-0800 I INDEX    [initandlisten] build index done.  scanned 0 total records. 0 secs
31 2017-11-28T23:47:59.438-0800 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.4
32 2017-11-28T23:47:59.439-0800 I NETWORK  [thread1] waiting for connections on port 27017

 

注意!端口为默认27017 ;

这时安装完成;

检查方式:[root@localhost bin]# ./mongo  这是进入到客户端就能看到了当前的版本信息;

[root@localhost bin]# ./mongo
MongoDB shell version v3.4.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.4
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: 
2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] 
2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-11-28T23:47:58.406-0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] 
2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2017-11-28T23:47:59.270-0800 I CONTROL  [initandlisten] 
2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] 
2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-11-28T23:47:59.272-0800 I CONTROL  [initandlisten] 
2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-11-28T23:47:59.275-0800 I CONTROL  [initandlisten] 
> 

端口开放:在防火墙开放27017端口就可以使用外部机器链接了;

使用命令 [root@localhost bin]# vi /etc/sysconfig/iptables
添加

-A INPUT -m state --state NEW -m tcp -p tcp --dport 27017 -j ACCEPT

保存退出;

外面安装好studio-3t就可以链接了;

 

 

 

最后需要环境包的可以在评论留下你的联系方式我会给你发一份.

转载于:https://www.cnblogs.com/DanBrown/p/7921169.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值