命令行登录
没有设置密码 /usr/local/mongodb/bin/mongo 127.0.0.1:28018
设置了密码就必须带着库和密码登录 /usr/local/mongodb/bin/mongo 127.0.0.1:28018/admin -u xjj -p mima
内存占用过高设置
查看WiredTiger内部缓存到底占用了多少内存的方式是,在mongo shell中之行以下命令
db.runCommand( { serverStatus: 1 } ).wiredTiger.cache["bytes currently in the cache"]:
如果不想重启mongoDB,可以在线修改,如下
db.adminCommand({setParameter: 1, wiredTigerEngineRuntimeConfig: "cache_size=8G"}):
监控工具使用
/usr/local/mongodb/bin/mongostat --host 8.129.212.222:28018 --username xjj --password password --authenticationDatabase admin
查询 区分变量类型 需注意
$where=[
'league_id'=>$club_id,
'uid'=>(int)$this->uid, //位数过长的 必须转类型
'ts'=>['$gte' => 1585670400,'$lt' => 1585756800],