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

TASK [mongod : Start the mongodb service] ERROR #274

Open
talhalatiforakzai opened this issue Jun 9, 2020 · 1 comment
Open

TASK [mongod : Start the mongodb service] ERROR #274

talhalatiforakzai opened this issue Jun 9, 2020 · 1 comment

Comments

@talhalatiforakzai
Copy link

talhalatiforakzai commented Jun 9, 2020

This task is not running how can i fix it

- name: Start the mongodb service
  command: creates=/var/lock/subsys/mongod-{{ inventory_hostname }} /etc/init.d/mongod-{{ inventory_hostname }} start
  delegate_to: '{{ item }}'
  with_items: "{{ groups.replication_servers }}"
TASK [mongod : Start the mongodb service]
failed: [mongo3 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.178736", "end": "2020-06-09 18:53:54.003886", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.825150", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo3 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo3 (via systemctl):  [FAILED]"]}
failed: [mongo1 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.195458", "end": "2020-06-09 18:53:54.015950", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.820492", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo1 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo1 (via systemctl):  [FAILED]"]}
failed: [mongo2 -> None] (item=mongo3) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.179355", "end": "2020-06-09 18:53:54.096899", "item": "mongo3", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:53.917544", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo2 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo2 (via systemctl):  [FAILED]"]}
failed: [mongo1 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.184622", "end": "2020-06-09 18:53:54.472741", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.288119", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo1 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo1 (via systemctl):  [FAILED]"]}
failed: [mongo3 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.210341", "end": "2020-06-09 18:53:54.487026", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.276685", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo3 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo3 (via systemctl):  [FAILED]"]}
failed: [mongo2 -> None] (item=mongo1) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.123928", "end": "2020-06-09 18:53:54.579645", "item": "mongo1", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.455717", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo2 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo2 (via systemctl):  [FAILED]"]}
failed: [mongo3 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo3", "start"], "delta": "0:00:00.200782", "end": "2020-06-09 18:53:54.957365", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.756583", "stderr": "Failed to start mongod-mongo3.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo3.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo3 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo3 (via systemctl):  [FAILED]"]}
failed: [mongo1 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo1", "start"], "delta": "0:00:00.182664", "end": "2020-06-09 18:53:54.939050", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.756386", "stderr": "Failed to start mongod-mongo1.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo1.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo1 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo1 (via systemctl):  [FAILED]"]}
failed: [mongo2 -> None] (item=mongo2) => {"ansible_loop_var": "item", "changed": true, "cmd": ["/etc/init.d/mongod-mongo2", "start"], "delta": "0:00:00.093683", "end": "2020-06-09 18:53:55.023951", "item": "mongo2", "msg": "non-zero return code", "rc": 5, "start": "2020-06-09 18:53:54.930268", "stderr": "Failed to start mongod-mongo2.service: Unit not found.", "stderr_lines": ["Failed to start mongod-mongo2.service: Unit not found."], "stdout": "Reloading systemd:  [  OK  ]\r\nStarting mongod-mongo2 (via systemctl):  [FAILED]", "stdout_lines": ["Reloading systemd:  [  OK  ]", "Starting mongod-mongo2 (via systemctl):  [FAILED]"]}

when i manually run mongod-mongo1/mongod-mongo2/mongod-mongo3 start manually i get

[root@mongo1 init.d]# /etc/init.d/mongod-mongo3 start
Reloading systemd:                                         [  OK  ]
Starting mongod-mongo3 (via systemctl):  Failed to start mongod-mongo3.service: Unit not found.
                                                           [FAILED]

when i run mongod restart

[root@mongo1 init.d]# sudo service mongod restart
Redirecting to /bin/systemctl restart mongod.service
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.

when i run systemctl status mongod.service

[root@mongo1 init.d]# systemctl status mongod.service
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2020-06-09 19:07:10 UTC; 15s ago
     Docs: https://docs.mongodb.org/manual
  Process: 5450 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
  Process: 5447 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 5444 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
  Process: 5442 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)

Jun 09 19:07:09 mongo1 systemd[1]: Starting MongoDB Database Server...
Jun 09 19:07:09 mongo1 mongod[5450]: about to fork child process, waiting until server is ready for connections.
Jun 09 19:07:09 mongo1 mongod[5450]: forked process: 5453
Jun 09 19:07:10 mongo1 systemd[1]: mongod.service: control process exited, code=exited status=14
Jun 09 19:07:10 mongo1 systemd[1]: Failed to start MongoDB Database Server.
Jun 09 19:07:10 mongo1 systemd[1]: Unit mongod.service entered failed state.
Jun 09 19:07:10 mongo1 systemd[1]: mongod.service failed.

My lab setup

#The site wide list of mongodb servers
mongo1 ansible_ssh_host=192.168.2.4
mongo2 ansible_ssh_host=192.168.2.5
mongo3 ansible_ssh_host=192.168.2.6

# the mongo servers need a mongod_port variable set, and they must not conflict.
[mongo_servers]
mongo1 mongod_port=2700
mongo2 mongod_port=2701
mongo3 mongod_port=2702

#The list of servers where replication should happen, by default include all servers
[replication_servers]
mongo3
mongo1
mongo2

#The list of mongodb configuration servers, make sure it is 1 or 3
[mongoc_servers]
mongo1
mongo2
mongo3


#The list of servers where mongos servers would run. 
[mongos_servers]
mongo1
mongo2

[all:vars]
ansible_connection=ssh
ansible_user=root
ansible_ssh_pass=vagrant
@licornduan
Copy link

See "journalctl -xe" for details, it's not ansiable problem.

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

No branches or pull requests

2 participants