mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
Merge pull request #957 from holta/mongodb-repair-if-no-lock
Fix for #942 ? "mongod --repair" if /library/dbdata/mongodb/mongod.lock absent
This commit is contained in:
commit
7356cf33ae
11 changed files with 30 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
|||
mongodb_install: False
|
||||
mongodb_enabled: False
|
||||
|
||||
mongodb_db_path: "{{ content_base }}/dbdata/mongodb" # == /library/dbdata/mongodb/
|
||||
mongodb_conf: /etc/mongod.conf
|
||||
mongodb_db_path: "{{ content_base }}/dbdata/mongodb" # == /library/dbdata/mongodb/
|
||||
mongodb_db_lock_file: "{{ mongodb_db_path }}/mongod.lock"
|
||||
|
|
|
@ -25,10 +25,11 @@
|
|||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
mode: "{{ item.mode }}"
|
||||
with_items:
|
||||
- { src: 'mongod.conf.j2', dest: "{{ mongodb_conf }}" }
|
||||
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service' }
|
||||
- { src: 'mongod.conf.j2', dest: "{{ mongodb_conf }}", mode: '0644' }
|
||||
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' }
|
||||
- { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' }
|
||||
|
||||
- name: Enable+restart systemd service if mongodb_enabled, with "systemctl daemon-reload" (in case mongodb.service changed?)
|
||||
systemd:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -f {{ mongodb_db_lock_file }} ]; then
|
||||
echo '"mongod --repair" cannot run when {{ mongodb_db_lock_file }} present.' >&2 # Output to STDERR but keep going, so /etc/systems/system/mongodb.service continues
|
||||
else
|
||||
/usr/bin/mongod --repair --dbpath {{ mongodb_db_path }}
|
||||
fi
|
|
@ -6,9 +6,15 @@ After=syslog.target network.target
|
|||
Type=simple
|
||||
User=mongodb
|
||||
Group=mongodb
|
||||
ExecStartPre=/usr/bin/mongod --repair --dbpath {{ mongodb_db_path }}
|
||||
# FAILS (after power failures, etc) as --repair cannot run when lock file exists: (https://github.com/iiab/iiab/issues/942)
|
||||
#ExecStartPre=/usr/bin/mongod --repair --dbpath /library/dbdata/mongodb
|
||||
# FAILS as systemd cannot run bash here:
|
||||
#ExecStartPre=if [ ! -f /library/dbdata/mongodb/mongod.lock ]; then /usr/bin/mongod --repair --dbpath {{ mongodb_db_path }}; fi
|
||||
ExecStartPre=/usr/bin/iiab-mongodb-repair-if-no-lock
|
||||
ExecStart=/usr/bin/mongod -f {{ mongodb_conf }}
|
||||
ExecStop=/usr/bin/killall mongod
|
||||
# killall's SIGTERM (15) seems fine, to induce a graceful stop. This would work too:
|
||||
#ExecStop=mongod --dbpath {{ mongodb_db_path }} --shutdown
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -342,6 +342,8 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Sugarizer
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: True
|
||||
sugarizer_enabled: False
|
||||
sugarizer_port: 8089
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: True
|
||||
sugarizer_enabled: True
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: True
|
||||
sugarizer_enabled: True
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: True
|
||||
sugarizer_enabled: True
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: True
|
||||
sugarizer_enabled: True
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: False
|
||||
sugarizer_enabled: False
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
|
@ -190,11 +190,9 @@ pathagar_install: False
|
|||
pathagar_enabled: False
|
||||
|
||||
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
|
||||
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
|
||||
sugarizer_install: False
|
||||
sugarizer_enabled: False
|
||||
# sugarizer_enabled is currently IGNORED as basic Sugarizer works w/o Journal!
|
||||
# https://github.com/iiab/iiab/issues/193 Subsequent "./runrole sugarizer" fail
|
||||
# https://github.com/iiab/iiab/issues/240 Sugarizer 0.8 to 0.9 ongoing issues
|
||||
|
||||
# 8-MGMT-TOOLS
|
||||
|
||||
|
|
Loading…
Reference in a new issue