Recipe: sc-mongodb::mongos
* ruby_block[chef_gem_at_converge_time] action run[2017-04-12T08:58:15+00:00] INFO: Processing ruby_block[chef_gem_at_converge_time] action run (sc-mongodb::mongos line 28)
[2017-04-12T08:58:21+00:00] INFO: ruby_block[chef_gem_at_converge_time] called
- execute the ruby block chef_gem_at_converge_time
* template[/etc/default/mongos] action create[2017-04-12T08:58:21+00:00] INFO: Processing template[/etc/default/mongos] action create (sc-mongodb::mongos line 134)
[2017-04-12T08:58:21+00:00] INFO: template[/etc/default/mongos] created file /etc/default/mongos
- create new file /etc/default/mongos[2017-04-12T08:58:21+00:00] INFO: template[/etc/default/mongos] updated file contents /etc/default/mongos
- update content in file /etc/default/mongos from none to ed5aeb
--- /etc/default/mongos 2017-04-12 08:58:21.838373999 +0000
+++ /etc/default/.chef-mongos20170412-4704-1vai01u 2017-04-12 08:58:21.838373999 +0000
@@ -1 +1,10 @@
+#
+# Automatically Generated by Chef, do not edit directly!
+#
+
+CONFIGFILE="/etc/mongos.conf"
+DAEMON="/usr/bin/$NAME"
+DAEMON_OPTS="--config /etc/mongos.conf"
+DAEMON_USER="mongodb"
+ENABLE_MONGODB="yes"[2017-04-12T08:58:21+00:00] INFO: template[/etc/default/mongos] owner changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/default/mongos] group changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/default/mongos] mode changed to 644
- change mode from '' to '0644'
- change owner from '' to 'root'
- change group from '' to 'root'
* template[/etc/mongos.conf] action create[2017-04-12T08:58:21+00:00] INFO: Processing template[/etc/mongos.conf] action create (sc-mongodb::mongos line 147)
[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] created file /etc/mongos.conf
- create new file /etc/mongos.conf[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] updated file contents /etc/mongos.conf
- update content in file /etc/mongos.conf from none to a57e87
--- /etc/mongos.conf 2017-04-12 08:58:21.850379999 +0000
+++ /etc/.chef-mongos20170412-4704-1bd2inx.conf 2017-04-12 08:58:21.850379999 +0000
@@ -1 +1,16 @@
+#
+# Automatically Generated by Chef, do not edit directly!
+#
+
+---
+net:
+ port: 27017
+ bindIp: 0.0.0.0
+systemLog:
+ destination: file
+ logAppend: true
+ path: "/var/log/mongodb/mongos.log"
+sharding:
+ configDB: 127.0.0.1:27019
+[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] owner changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] group changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] mode changed to 644
- change mode from '' to '0644'
- change owner from '' to 'root'
- change group from '' to 'root'
[2017-04-12T08:58:21+00:00] INFO: template[/etc/mongos.conf] not queuing delayed action restart on service[mongos] (delayed), as it's already been queued
* directory[/var/log/mongodb] action create[2017-04-12T08:58:21+00:00] INFO: Processing directory[/var/log/mongodb] action create (sc-mongodb::mongos line 161)
[2017-04-12T08:58:21+00:00] WARN: only_if block for directory[/var/log/mongodb] returned "/var/log/mongodb/mongod.log", did you mean to run a command? If so use 'only_if "/var/log/mongodb/mongod.log"' in your code.
(up to date)
* directory[/data] action create[2017-04-12T08:58:21+00:00] INFO: Processing directory[/data] action create (sc-mongodb::mongos line 171)
(skipped due to not_if)
* execute[mongodb-systemctl-daemon-reload-mongos] action nothing[2017-04-12T08:58:21+00:00] INFO: Processing execute[mongodb-systemctl-daemon-reload-mongos] action nothing (sc-mongodb::mongos line 181)
(skipped due to action :nothing)
* template[/etc/init.d/mongos] action create[2017-04-12T08:58:21+00:00] INFO: Processing template[/etc/init.d/mongos] action create (sc-mongodb::mongos line 187)
[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] created file /etc/init.d/mongos
- create new file /etc/init.d/mongos[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] updated file contents /etc/init.d/mongos
- update content in file /etc/init.d/mongos from none to e144b4
--- /etc/init.d/mongos 2017-04-12 08:58:21.866387999 +0000
+++ /etc/init.d/.chef-mongos20170412-4704-1qoezrc 2017-04-12 08:58:21.866387999 +0000
@@ -1 +1,265 @@
+#!/bin/bash
+#
+# init.d script with LSB support.
+#
+# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
+# Copyright (c) 2011 edelight GmbH
+# Author: Markus Korn <markus.korn@edelight.de>
+#
+# This is free software; you may redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2,
+# or (at your option) any later version.
+#
+# This is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License with
+# the Debian operating system, in /usr/share/common-licenses/GPL; if
+# not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+#
+### BEGIN INIT INFO
+# Provides: mongos
+# Required-Start: $network $local_fs $remote_fs
+# Required-Stop: $network $local_fs $remote_fs
+# Should-Start: $named
+# Should-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start/stop mongos An object/document-origented database
+# Description: MongoDB is a high-performance, open source, schema-free
+# document-oriented data store that's easy to deploy, manage
+# and use. It's network accessible, written in C++ and offers
+# the following features:
+#
+# * Collection oriented storage - easy storage of object-
+# style data
+# * Full index support, including on inner objects
+# * Query profiling
+# * Replication and fail-over support
+# * Efficient storage of binary data including large
+# objects (e.g. videos)
+# * Auto-sharding for cloud-level scalability (Q209)
+#
+# High performance, scalability, and reasonable depth of
+# functionality are the goals for the project.
+### END INIT INFO
+#
+NAME=mongos
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC=database
+PIDFILE=/var/run/$NAME.pid
+ENABLE_MONGODB=yes
+SYSCONFIG=/etc/default/mongos
+
+# this should get removed at some point for more shell agnostic init script
+ulimit -f unlimited
+ulimit -t unlimited
+ulimit -v unlimited
+ulimit -n 64000
+ulimit -m unlimited
+ulimit -u 32000
+
+# Include mongodb defaults if available
+if [ -f $SYSCONFIG ] ; then
+ . $SYSCONFIG
+fi
+
+# Handle NUMA access to CPUs (SERVER-3574)
+# This verifies the existence of numactl as well as testing that the command works
+NUMACTL_ARGS="--interleave=all"
+if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
+then
+ NUMACTL="`which numactl` -- $NUMACTL_ARGS"
+ DAEMON_OPTS="$DAEMON_OPTS"
+else
+ NUMACTL=""
+ DAEMON_OPTS="-- $DAEMON_OPTS"
+fi
+
+if test ! -x $DAEMON; then
+ echo "Could not find $DAEMON"
+ exit 0
+fi
+
+if test "x$ENABLE_MONGODB" != "xyes"; then
+ exit 0
+fi
+
+. /lib/lsb/init-functions
+
+STARTTIME=1
+DIETIME=10 # Time to wait for the server to die, in seconds
+ # If this value is set too low you might not
+ # let some servers to die gracefully and
+ # 'restart' will not work
+
+DAEMON_USER=${DAEMON_USER:-mongodb}
+
+# debugging
+echo "** Running $NAME ($DAEMON $DAEMON_OPTS)"
+
+set -e
+
+
+running_pid() {
+# Check if a given process pid's cmdline matches a given name
+ pid=$1
+ name=$2
+ [ -z "$pid" ] && return 1
+ [ ! -d /proc/$pid ] && return 1
+ cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
+ # Is this the expected server
+ [ "$cmd" != "$name" ] && return 1
+ return 0
+}
+
+running() {
+# Check if the process is running looking at /proc
+# (works for all users)
+
+ # No pidfile, probably no daemon present
+ [ ! -f "$PIDFILE" ] && return 1
+ pid=`cat $PIDFILE`
+ running_pid $pid $DAEMON || return 1
+ for i in `seq 1 20`; do
+ nc -z 0.0.0.0 27017 && return 0
+ echo -n "."
+ sleep 15
+ done
+ return 1
+}
+
+start_server() {
+# Start the process using the wrapper
+ start-stop-daemon --background --start --quiet --pidfile $PIDFILE \
+ --make-pidfile --chuid $DAEMON_USER \
+ --exec $NUMACTL $DAEMON $DAEMON_OPTS
+ errcode=$?
+ return $errcode
+}
+
+stop_server() {
+# Stop the process using the wrapper
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+ --retry 300 \
+ --user $DAEMON_USER \
+ --exec $DAEMON
+ errcode=$?
+ return $errcode
+}
+
+force_stop() {
+# Force the process to die killing it manually
+ [ ! -e "$PIDFILE" ] && return
+ if running ; then
+ kill -15 $pid
+ # Is it really dead?
+ sleep "$DIETIME"s
+ if running ; then
+ kill -9 $pid
+ sleep "$DIETIME"s
+ if running ; then
+ echo "Cannot kill $NAME (pid=$pid)!"
+ exit 1
+ fi
+ fi
+ fi
+ rm -f $PIDFILE
+}
+
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ # Check if it's running first
+ if running ; then
+ log_progress_msg "apparently already running"
+ log_end_msg 0
+ exit 0
+ fi
+ if start_server ; then
+ # NOTE: Some servers might die some time after they start,
+ # this code will detect this issue if STARTTIME is set
+ # to a reasonable value
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
+ if running ; then
+ # It's ok, the server started and is running
+ log_end_msg 0
+ else
+ # It is not running after we did start
+ log_end_msg 1
+ fi
+ else
+ # Either we could not start it
+ log_end_msg 1
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ if running ; then
+ # Only stop the server if we see it running
+ errcode=0
+ stop_server || errcode=$?
+ log_end_msg $errcode
+ else
+ # If it's not running don't do anything
+ log_progress_msg "apparently not running"
+ log_end_msg 0
+ exit 0
+ fi
+ ;;
+ force-stop)
+ # First try to stop gracefully the program
+ $0 stop
+ if running; then
+ # If it's still running try to kill it more forcefully
+ log_daemon_msg "Stopping (force) $DESC" "$NAME"
+ errcode=0
+ force_stop || errcode=$?
+ log_end_msg $errcode
+ fi
+ ;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ errcode=0
+ stop_server || errcode=$?
+ # Wait some sensible amount, some server need this
+ [ -n "$DIETIME" ] && sleep $DIETIME
+ start_server || errcode=$?
+ [ -n "$STARTTIME" ] && sleep $STARTTIME
+ running || errcode=$?
+ log_end_msg $errcode
+ ;;
+ status)
+
+ log_daemon_msg "Checking status of $DESC" "$NAME"
+ if running ; then
+ log_progress_msg "running"
+ log_end_msg 0
+ else
+ log_progress_msg "apparently not running"
+ log_end_msg 1
+ exit 1
+ fi
+ ;;
+ # MongoDB can't reload its configuration.
+ reload)
+ log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
+ log_warning_msg "cannot re-read the config file (use restart)."
+ ;;
+
+ *)
+ N=/etc/init.d/$NAME
+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
+[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] owner changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] group changed to 0
[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] mode changed to 755
- change mode from '' to '0755'
- change owner from '' to 'root'
- change group from '' to 'root'
[2017-04-12T08:58:21+00:00] INFO: template[/etc/init.d/mongos] not queuing delayed action restart on service[mongos] (delayed), as it's already been queued
* service[mongos] action enable[2017-04-12T08:58:21+00:00] INFO: Processing service[mongos] action enable (sc-mongodb::mongos line 209)
[2017-04-12T08:58:22+00:00] INFO: service[mongos] enabled
- enable service service[mongos]
[2017-04-12T08:58:22+00:00] INFO: service[mongos] sending create action to ruby_block[config_sharding] (immediate)
* ruby_block[config_sharding] action create[2017-04-12T08:58:22+00:00] INFO: Processing ruby_block[config_sharding] action create (sc-mongodb::mongos line 265)
[2017-04-12T08:58:22+00:00] INFO: {}
[2017-04-12T08:58:22+00:00] INFO: []
[2017-04-12T08:58:22+00:00] WARN: No sharded collections configured, doing nothing
[2017-04-12T08:58:22+00:00] INFO: ruby_block[config_sharding] called
- execute the ruby block config_sharding
* service[mongos] action start[2017-04-12T08:58:22+00:00] INFO: Processing service[mongos] action start (sc-mongodb::mongos line 209)
================================================================================
Error executing action `start` on resource 'service[mongos]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '6'
---- Begin output of /etc/init.d/mongos start ----
STDOUT: Starting mongos (via systemctl): mongos.service failed!
STDERR: Failed to start mongos.service: Unit mongos.service failed to load: No such file or directory.
---- End output of /etc/init.d/mongos start ----
Ran /etc/init.d/mongos start returned 6
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/sc-mongodb/definitions/mongodb.rb
209: service new_resource.name do
210: case node['platform']
211: when 'ubuntu'
212: if node['platform_version'].to_f >= 15.04
213: provider Chef::Provider::Service::Systemd
214: end
215: else
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:209:in `block in from_file'
service("mongos") do
params {:mongodb_type=>"mongos", :action=>[:enable, :start], :logpath=>"/var/log/mongodb/mongod.log", :dbpath=>"/data", :configservers=>[#<Chef::Node:0x000000034080c8 @chef_server_rest=nil, @name="mongodb-configserver-001", @chef_environment="_default", @primary_runlist=#<Chef::RunList:0x00000003408050 @run_list_items=[#<Chef::RunList::RunListItem:0x00000003455b70 @version=nil, @type=:role, @name="mongodb-configserver">]>, @override_runlist=#<Chef::RunList:0x0000000340bd90 @run_list_items=[]>, @policy_name=nil, @policy_group=nil, @attributes=#<Chef::Node::Attribute @default={"mongodb"=>{"cluster_name"=>"default", "is_configserver"=>"true"}, "mongodb_cluster_name"=>"default", "mongodb_is_configserver"=>"true"}, @env_default={}, @role_default={}, @force_default={}, @normal={"mongodb"=>{"cluster_name"=>"default", "is_configserver"=>"true"}, "mongodb_cluster_name"=>"default", "mongodb_is_configserver"=>"true"}, @override={}, @role_override={}, @env_override={}, @force_override={}, @automatic={"hostname"=>"vagrant.vm", "os"=>"centos"}, @merged_attributes=nil, @properties=nil>, @run_state={}>], :replicaset=>nil, :notifies=>[], :name=>"mongos"}
action [:enable, :start]
updated true
supports {:status=>true, :restart=>true}
retries 0
retry_delay 2
default_guard_interpreter :default
service_name "mongos"
enabled true
running nil
masked nil
pattern "mongos"
declared_type :service
cookbook_name "sc-mongodb"
recipe_name "mongos"
end
Platform:
---------
x86_64-linux
[2017-04-12T08:58:22+00:00] INFO: Running queued delayed notifications before re-raising exception
[2017-04-12T08:58:22+00:00] INFO: template[/etc/default/mongodb] sending restart action to service[mongod] (delayed)
Recipe: sc-mongodb::configserver
* service[mongod] action restart[2017-04-12T08:58:22+00:00] INFO: Processing service[mongod] action restart (sc-mongodb::configserver line 209)
[2017-04-12T08:58:22+00:00] INFO: service[mongod] restarted
- restart service service[mongod]
[2017-04-12T08:58:22+00:00] INFO: template[/etc/default/mongos] sending restart action to service[mongos] (delayed)
Recipe: sc-mongodb::mongos
* service[mongos] action restart[2017-04-12T08:58:22+00:00] INFO: Processing service[mongos] action restart (sc-mongodb::mongos line 209)
================================================================================
Error executing action `restart` on resource 'service[mongos]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '6'
---- Begin output of /etc/init.d/mongos restart ----
STDOUT: Restarting mongos (via systemctl): mongos.service failed!
STDERR: Failed to restart mongos.service: Unit mongos.service failed to load: No such file or directory.
---- End output of /etc/init.d/mongos restart ----
Ran /etc/init.d/mongos restart returned 6
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/sc-mongodb/definitions/mongodb.rb
209: service new_resource.name do
210: case node['platform']
211: when 'ubuntu'
212: if node['platform_version'].to_f >= 15.04
213: provider Chef::Provider::Service::Systemd
214: end
215: else
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/sc-mongodb/definitions/mongodb.rb:209:in `block in from_file'
service("mongos") do
params {:mongodb_type=>"mongos", :action=>[:enable, :start], :logpath=>"/var/log/mongodb/mongod.log", :dbpath=>"/data", :configservers=>[#<Chef::Node:0x000000034080c8 @chef_server_rest=nil, @name="mongodb-configserver-001", @chef_environment="_default", @primary_runlist=#<Chef::RunList:0x00000003408050 @run_list_items=[#<Chef::RunList::RunListItem:0x00000003455b70 @version=nil, @type=:role, @name="mongodb-configserver">]>, @override_runlist=#<Chef::RunList:0x0000000340bd90 @run_list_items=[]>, @policy_name=nil, @policy_group=nil, @attributes=#<Chef::Node::Attribute @default={"mongodb"=>{"cluster_name"=>"default", "is_configserver"=>"true"}, "mongodb_cluster_name"=>"default", "mongodb_is_configserver"=>"true"}, @env_default={}, @role_default={}, @force_default={}, @normal={"mongodb"=>{"cluster_name"=>"default", "is_configserver"=>"true"}, "mongodb_cluster_name"=>"default", "mongodb_is_configserver"=>"true"}, @override={}, @role_override={}, @env_override={}, @force_override={}, @automatic={"hostname"=>"vagrant.vm", "os"=>"centos"}, @merged_attributes=nil, @properties=nil>, @run_state={}>], :replicaset=>nil, :notifies=>[], :name=>"mongos"}
action [:enable, :start]
updated true
supports {:status=>true, :restart=>true}
retries 0
retry_delay 2
default_guard_interpreter :default
service_name "mongos"
enabled true
running nil
masked nil
pattern "mongos"
declared_type :service
cookbook_name "sc-mongodb"
recipe_name "mongos"
end
Platform:
---------
x86_64-linux
Running handlers:
[2017-04-12T08:58:22+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-12T08:58:22+00:00] ERROR: Exception handlers complete
Chef Client failed. 24 resources updated in 42 seconds
[2017-04-12T08:58:22+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2017-04-12T08:58:22+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-12T08:58:22+00:00] ERROR: Chef::Exceptions::MultipleFailures
[2017-04-12T08:58:22+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)