cfg = rs.conf()
cfg.members[0].priority = 0.5
cfg.members[1].priority = 1
cfg.members[2].priority = 0.5
rs.reconfig(cfg)
分类目录归档:mongodb
PHP MongoDB各版本库和扩展版本对应关系
PHP Driver | MongoDB 4.0 | MongoDB 3.6 | MongoDB 3.4 | MongoDB 3.2 | MongoDB 3.0 | MongoDB 2.6 |
---|---|---|---|---|---|---|
PHPLIB 1.4 + mongodb-1.5 | ✓ | ✓ | ✓ | ✓ | ✓ | |
PHPLIB 1.3 + mongodb-1.4 | ✓ | ✓ | ✓ | ✓ | ✓ | |
PHPLIB 1.2 + mongodb-1.3 | ✓ | ✓ | ✓ | ✓ | ||
PHPLIB 1.1 + mongodb-1.2 | ✓ | ✓ | ✓ | ✓ | ||
PHPLIB 1.0 + mongodb-1.1 | ✓ | ✓ | ✓ | |||
mongodb-1.0 | ✓ | ✓ |
Detected corrupt BSON data
数据里面看到是乱码
No suitable servers found (`serverSelectionTryOnce` set)
连接数据库时配置了replicaSet,而目标机器没有开启副本集,去掉代码里的replicaSet配置即可
mongodb 3.4 官方资源导航
1. keyfiles内部验证
https://docs.mongodb.com/manual/core/security-internal-authentication/#keyfiles
2. 使用keyfile进行复制集之间的验证
https://docs.mongodb.com/manual/tutorial/enforce-keyfile-access-control-in-existing-replica-set/
3. 用户权限规矩
https://docs.mongodb.com/manual/reference/built-in-roles/#built-in-roles
** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
卸载分区
umount /mnt/mongo
格式化为xfs(会丢失所有数据)
mkfs.xfs /dev/mapper/vg1-lvMongo -f
修改fstab,类型修改为xfs
vim /etc/fstab
change ext4 to xfs
自动挂载
mount -a
CouchDB 笔记
CouchDB PHP客户端:https://github.com/sn01615/couchdb-client
创建数据库
curl -X PUT http://127.0.0.1:5984/test
获取数据库列表
curl -X GET http://127.0.0.1:5984/_all_dbs
创建数据库
curl -vX PUT http://127.0.0.1:5984/albums-backup
删除数据库
curl -vX DELETE http://127.0.0.1:5984/albums-backup
保存一条数据
curl -X PUT http://127.0.0.1:5984/test/6e1295ed6c29495e54cc05947f18c8af -d ‘{“title”:”There is Nothing Left to Lose”,”artist”:”Foo Fighters”}’
获取一条数据
curl -X GET http://127.0.0.1:5984/test/6e1295ed6c29495e54cc05947f18c8af
创建用户名密码
HOST=”http://127.0.0.1:5984″
curl -X PUT $HOST/_config/admins/username -d ‘”password”‘
要在配置文件里设置密码
使用用户名密码获取数据
HOST=”http://username:password@127.0.0.1:5984″
curl -X GET $HOST/test/6e1295ed6c29495e54cc05947f18c8af