mongodb数据库环境配置

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/qq_40605167/article/details/81412606

1.下载mongodb
https://www.mongodb.com/download-center#community
2.下载安装完成后,打开安装的文件夹找到data的文件夹,然后打开data文件夹在data文件夹中新建一个db文件夹。用来存放数据和配置信息
3然后返回上一层文件夹,进入bin文件夹,按住shift,然后右键点击在此处打开powershell窗口。
4 输入命令:./mongod –dbpath 你刚刚新建的那个db的文件夹路径
例如:
PS D:\mongo\bin> ./mongod –dbpath D:\mongo\data\db

PS D:\mongo\bin> ./mongod --dbpath D:\mongo\data\db
2018-08-04T16:09:38.334+0800 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-08-04T16:09:39.013+0800 I CONTROL  [initandlisten] MongoDB starting : pid=11976 port=27017 dbpath=D:\mongo\data\db 64-bit host=DESKTOP-8NFVDR3
2018-08-04T16:09:39.013+0800 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-08-04T16:09:39.014+0800 I CONTROL  [initandlisten] db version v4.0.0
2018-08-04T16:09:39.014+0800 I CONTROL  [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-08-04T16:09:39.015+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2018-08-04T16:09:39.015+0800 I CONTROL  [initandlisten] modules: none
2018-08-04T16:09:39.016+0800 I CONTROL  [initandlisten] build environment:
2018-08-04T16:09:39.016+0800 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2018-08-04T16:09:39.017+0800 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-04T16:09:39.017+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-04T16:09:39.018+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "D:\mongo\data\db" } }
2018-08-04T16:09:39.031+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1488M,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),statistics_log=(wait=0),verbose=(recovery_progress),
2018-08-04T16:09:39.086+0800 I STORAGE  [initandlisten] WiredTiger message [1533370179:85499][11976:140710581985616], txn-recover: Set global recovery timestamp: 0
2018-08-04T16:09:39.105+0800 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-08-04T16:09:39.155+0800 I CONTROL  [initandlisten]
2018-08-04T16:09:39.155+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-08-04T16:09:39.156+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-08-04T16:09:39.159+0800 I CONTROL  [initandlisten]
2018-08-04T16:09:39.159+0800 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-08-04T16:09:39.160+0800 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2018-08-04T16:09:39.160+0800 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-08-04T16:09:39.160+0800 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-08-04T16:09:39.161+0800 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-08-04T16:09:39.161+0800 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-08-04T16:09:39.161+0800 I CONTROL  [initandlisten]
2018-08-04T16:09:39.162+0800 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 0b2d322c-78a1-421e-b50d-bab3fc210c69
2018-08-04T16:09:39.199+0800 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.0
2018-08-04T16:09:39.205+0800 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: 851bac0e-d3c6-4d8d-882e-a08afd5a63ad
2018-08-04T16:09:40.392+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'D:/mongo/data/db/diagnostic.data'
2018-08-04T16:09:40.397+0800 I STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: e329a032-8eee-4669-86b8-9558973d5bef
2018-08-04T16:09:40.397+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
2018-08-04T16:09:40.447+0800 I INDEX    [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
2018-08-04T16:09:40.448+0800 I INDEX    [LogicalSessionCacheRefresh]     building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-08-04T16:09:40.456+0800 I INDEX    [LogicalSessionCacheRefresh] build index done.  scanned 0 total records. 0 secs

验证是否安装成功:打开浏览器:输入localhost:27017
如果页面出现:

It looks like you are trying to access MongoDB over HTTP on the native driver port.

即安装配置成功

猜你喜欢

转载自blog.csdn.net/qq_40605167/article/details/81412606