zoukankan      html  css  js  c++  java
  • mgo03_linux7上安装mongo4.0

    下载地址https://www.mongodb.com/download-center#community

    tar -xvf mongodb-linux-x86_64-rhel70-4.0.0.tgz
    mv mongodb-linux-x86_64-rhel70-4.0.0 /usr/local/mongodb


    MongoDB 的可执行文件位于 bin 目录下,所以可以将其添加到 PATH 路径中:
    export PATH=/usr/local/mongodb/bin:$PATH

    创建数据库目录
    MongoDB的数据存储在data目录的db目录下,但是这个目录在安装过程不会自动创建,所以你需要手动创建data目录,并在data目录中创建db目录。

    以下实例中我们将data目录创建于根目录下(/)。注意:/data/db 是 MongoDB 默认的启动的数据库路径(--dbpath)。

    mkdir -p /data/db


    命令行中运行 MongoDB 服务
    你可以再命令行中执行mongo安装目录中的bin目录执行mongod命令来启动mongdb服务。
    注意:如果你的数据库目录不是/data/db,可以通过 --dbpath 来指定。

    mongod
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten]
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten]
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten]
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten]
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
    2018-07-19T14:24:49.259+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
    2018-07-19T14:24:49.450+0800 I NETWORK [initandlisten] waiting for connections on port 27017

    连接
    mongo
    > db
    test
    > show dbs
    admin 0.000GB
    config 0.000GB
    local 0.000GB

  • 相关阅读:
    姐姐的vue(1)
    LeetCode 64. Minimum Path Sum 20170515
    LeetCode 56. 56. Merge Intervals 20170508
    LeetCode 26. Remove Duplicates from Sorted Array
    LeetCode 24. Swap Nodes in Pairs 20170424
    LeetCode 19. Remove Nth Node From End of List 20170417
    LeetCode No.9 Palindrome Number 20170410
    LeetCode No.8. String to Integer (atoi) 2017/4/10(补上一周)
    LeetCode No.7 Reverse Integer 2017/3/27
    LeetCode No.4 Median of Two Sorted Arrays 20170319
  • 原文地址:https://www.cnblogs.com/perfei/p/9335834.html
Copyright © 2011-2022 走看看