Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
88a7fca7
Commit
88a7fca7
authored
9 years ago
by
Feanil Patel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2454 from edx/feanil/prefer_hidden
Update the ad-hoc-reporting mongo script.
parents
b797b47f
efa0afc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
playbooks/roles/ad_hoc_reporting/templates/edx/bin/mongo.sh.j2
+11
-2
No files found.
playbooks/roles/ad_hoc_reporting/templates/edx/bin/mongo.sh.j2
View file @
88a7fca7
...
...
@@ -3,10 +3,19 @@
db_hosts
={{
","
.join
(
item.db_hosts
)
}}
from_port
={{
item.db_port
}}
for
host
in
${
db_hosts
//,/
}
;
do
if
[[
$(
mongo
${
host
}
:
{{
item.db_port
}}
/
{{
item.db_name
}}
-u
{{
COMMON_MONGO_READ_ONLY_USER
}}
-p
"{{ COMMON_MONGO_READ_ONLY_PASS }}"
--eval
"printjson(db.isMaster())"
)
=
~ secondary
\"\ \:\
true
]]
;
then
is_secondary
=
$(
mongo
${
host
}
:
{{
item.db_port
}}
/
{{
item.db_name
}}
-u
{{
COMMON_MONGO_READ_ONLY_USER
}}
-p
"{{ COMMON_MONGO_READ_ONLY_PASS }}"
--quiet
--eval
"printjson(db.isMaster()['secondary'])"
)
is_hidden
=
$(
mongo
${
host
}
:
{{
item.db_port
}}
/
{{
item.db_name
}}
-u
{{
COMMON_MONGO_READ_ONLY_USER
}}
-p
"{{ COMMON_MONGO_READ_ONLY_PASS }}"
--quiet
--eval
"printjson(db.isMaster()['hidden'])"
)
if
[[
$is_hidden
==
"true"
]]
;
then
replica
=
$host
# Found a hidden secondary no need to keep looking.
break
fi
if
[[
$is_secondary
==
"true"
]]
;
then
replica
=
$host
# Found a secondary but there could be a hidden secondary.
# keep looking.
fi
done
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment