mongodb

Mongodb Shard集群手动将大块的jumbo chunk拆分

Mongodb Shard集群手动将大块的jumbo chunk拆分

Mongodb Shard Manual Split Jumbo Chunk

suo.li
最近压测MongoDB Shard集群时发现集群中四个shard 的shard1的primary机器负载异常的高,其它三个shard 的primary负载在40%左右,shard1的primary负载就已经 飙升超过80%,经过查看日志发现shar
Mongodb Shard集群中的复制集主备切换

Mongodb Shard集群中的复制集主备切换

Mongodb shard active-Standby switch

suo.li
最近公司准备上线新的业务,需要压测MongoDB Shard集群采用多个机器来回放日志进行压测, 使用js解析以往的日志,并拼装成新的请求来请求服务,进行压测。使用25台机器并发发起 请求,每分钟20000个请求,MongoDB Shard集群的p
将PG数据库中的表数据导出到MongoDB

将PG数据库中的表数据导出到MongoDB

Export data from postgresql to mongodb

suo.li
1. PG sql 使用row_to_json()函数将数据转为json格式 使用COPY命令将数据写到标准输出 注意:使用COPY命令直接将表数据写到某个文件中需要superuser权限 1 > select regextappid as appid, bindings->'devid' as devid, bindings->'wechat' as wechat from user_info; 2. > SELECT row_to_json(sso_bindings) FROM ( select regextappid as appid, bindings->'devid' as devid, bindings->'wechat' as wechat from user_info ) sso_bindings; 3.
Mongodb shard cluster

Mongodb shard cluster

Mongodb shard cluster deploy

suo.li
Intro MongoDB shard(分片) 分片是MongoDB shard 集群中的一个概念,它将跨多个MongoDB实例的大型数据集拆分为 小型数据集存储在不同的分片(shard)中。 有时,MongoDB中的数据会非常庞大​​,以至于对如此大的数据集进行查询会导致服务器上
Mongodb install

Mongodb install

Mongodb install

suo.li
Stand alone installation install https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.7.tgz ~# pwd /usr/local/src ~# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.2.7.tgz ~# tar -xf mongodb-linux-x86_64-ubuntu1804-4.2.7.tgz ~# ln -s /usr/local/mongodb-427 /usr/local/src/mongodb-linux-x86_64-ubuntu1804-4.2.7 ~# vim /etc/profile.d/mongodb.sh #!/usr/bin/env bash export PATH=/usr/local/mongodb-427/bin:$PATH ~# source /etc/profile.d/mongodb.sh edit mongod.conf ~# vim /etc/mongd.con processManagement: fork: true pidFilePath: /var/lib/mongo/db1.pid net: bindIp: localhost port: 27017 storage: dbPath: /var/lib/mongo systemLog: destination: file path: "/var/log/mongo/mongod.log" logAppend: true storage: journal: enabled: true replication: replSetName: csRS add mongodb user and edit service file add user mongodb ~# useradd -r 555 mongodb edit service file ~# vim /lib/systemd/system/mongodb.service [Unit] Description=High-performance, schema-free document-oriented database After=syslog.target network.target [Service] Type=forking User=mongodb Group=mongodb EnvironmentFile=/etc/mongod ExecStart=/usr/local/mongodb-427/bin/mongod $OPTIONS run PrivateTmp=true LimitNOFILE=64000 TimeoutStartSec=180 [Install] WantedBy=multi-user.target ~# vim /etc/mongd OPTIONS="--quiet -f /etc/mongod.conf" dirs and permissions ~# mkdir /var/{lib,log}/mongo -p ~# chown -R mongodb.mongodb /var/{lib,log}/mongo start mongodb ~# systemctl daemon-reload ~# systemctl start mongodb.