ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

mongo集群测试

2022-01-18 18:35:53  阅读:239  来源: 互联网

标签:03 mongo 27017 18T18 集群 测试 172.16 id


[root@MYSQL01 ~]# mongo 172.16.59.21:27017
MongoDB shell version v5.0.5
connecting to: mongodb://172.16.59.21:27017/test?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("6297fc54-42a2-47b5-b26f-fae0ec85c21d") }
MongoDB server version: 5.0.5
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
---
The server generated these startup warnings when booting: 
        2022-01-18T18:03:35.688+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
        2022-01-18T18:03:35.688+08:00: You are running this process as the root user, which is not recommended
        2022-01-18T18:03:35.691+08:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never'
        2022-01-18T18:03:35.692+08:00: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never'
        2022-01-18T18:03:35.692+08:00: Soft rlimits for open file descriptors too low
        2022-01-18T18:03:35.692+08:00:         currentValue: 1024
        2022-01-18T18:03:35.692+08:00:         recommendedMinimum: 64000
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> 

> use admin
switched to db admin
> cfg={ _id:"testrs", members:[ {_id:0,host:'172.16.59.21:27017',priority:2}, {_id:1,host:'172.16.59.22:27017',priority:1},   {_id:2,host:'172.16.59.23:27017',arbiterOnly:true}] };
{
        "_id" : "testrs",
        "members" : [
                {
                        "_id" : 0,
                        "host" : "172.16.59.21:27017",
                        "priority" : 2
                },
                {
                        "_id" : 1,
                        "host" : "172.16.59.22:27017",
                        "priority" : 1
                },
                {
                        "_id" : 2,
                        "host" : "172.16.59.23:27017",
                        "arbiterOnly" : true
                }
        ]
}
> rs.initiate(cfg) 
{ "ok" : 1 }
testrs:SECONDARY> 


mongo 172.16.59.21:27017
mongo 172.16.59.22:27017
mongo 172.16.59.23:27017


java 连接 https://mongodb.github.io/mongo-java-driver/3.4/driver/tutorials/connect-to-mongodb/

标签:03,mongo,27017,18T18,集群,测试,172.16,id
来源: https://www.cnblogs.com/heidsoft/p/15819136.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有