Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update - fix bug:不支持sharding模式的mongo #192

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

NicoleRobin
Copy link

MongoDB的sharding模式下Upsert操作要求必须指定sharding key,使用到Upsert操作的collection有:stat、job_latest_log,为了最小改动的方式解决这个问题;
针对job_latest_log,只需要创建collection时指定sharding key即可,不涉及代码修改:
db.runCommand({shardcollection:"cronsun1.job_latest_log", key:{node:1, hostname:1, ip:1, jobId:1, jobGroup:1}});
针对stat,需要将其拆分为两个:stat、daily_stat,然后分别指定sharding key:

db.runCommand({shardcollection:"cronsun1.stat", key:{name:1}});
db.runCommand({shardcollection:"cronsun1.daily_stat", key:{name:1, date:1}});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant