Server Services
The Chef Infra Server has a built in process supervisor, which ensures that all of the required services are in the appropriate state at any given time. The supervisor starts two processes per service.
Service Subcommands
This command has a built in process supervisor that ensures all of the
required services are in the appropriate state at any given time. The
supervisor starts two processes per service and provides the following
subcommands for managing services: hup
, int
, kill
, once
,
restart
, service-list
, start
, status
, stop
, tail
, and
term
.
hup
The hup
subcommand is used to send a SIGHUP
to all services. This
command can also be run for an individual service by specifying the name
of the service in the command.
This subcommand has the following syntax:
chef-server-ctl hup SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
int
The int
subcommand is used to send a SIGINT
to all services. This
command can also be run for an individual service by specifying the name
of the service in the command.
This subcommand has the following syntax:
chef-server-ctl int SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
kill
The kill
subcommand is used to send a SIGKILL
to all services. This
command can also be run for an individual service by specifying the name
of the service in the command.
This subcommand has the following syntax:
chef-server-ctl kill SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
once
The supervisor for the Chef Infra Server is configured to restart any
service that fails, unless that service has been asked to change its
state. The once
subcommand is used to tell the supervisor to not
attempt to restart any service that fails.
This command is useful when troubleshooting configuration errors that
prevent a service from starting. Run the once
subcommand followed by
the status
subcommand to look for services in a down state and/or to
identify which services are in trouble. This command can also be run for
an individual service by specifying the name of the service in the
command.
This subcommand has the following syntax:
chef-server-ctl once SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
restart
The restart
subcommand is used to restart all services enabled on the
Chef Infra Server or to restart an individual service by specifying the
name of that service in the command.
Warning
When running the Chef Infra Server in a high availability configuration, restarting all services may trigger failover.
This subcommand has the following syntax:
chef-server-ctl restart SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand. When a service is
successfully restarted the output should be similar to:
ok: run: service_name: (pid 12345) 1s
service-list
The service-list
subcommand is used to display a list of all available
services. A service that is enabled is labeled with an asterisk (*).
This subcommand has the following syntax:
chef-server-ctl service-list
start
The start
subcommand is used to start all services that are enabled in
the Chef Infra Server. This command can also be run for an individual
service by specifying the name of the service in the command.
This subcommand has the following syntax:
chef-server-ctl start SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand. When a service is
successfully started the output should be similar to:
ok: run: service_name: (pid 12345) 1s
The supervisor for the Chef Infra Server is configured to wait seven
seconds for a service to respond to a command from the supervisor. If
you see output that references a timeout, it means that a signal has
been sent to the process, but that the process has yet to actually
comply. In general, processes that have timed out are not a big concern,
unless they are failing to respond to the signals at all. If a process
is not responding, use a command like the kill
subcommand to stop the
process, investigate the cause (if required), and then use the start
subcommand to re-enable it.
status
The status
subcommand is used to show the status of all services
available to the Chef Infra Server. The results will vary based on the
configuration of a given server. This subcommand has the following
syntax:
chef-server-ctl status
and will return the status for all services. Status can be returned for individual services by specifying the name of the service as part of the command:
chef-server-ctl status SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
When service status is requested, the output should be similar to:
run: service_name: (pid 12345) 12345s; run: log: (pid 1234) 67890s
where
run:
is the state of the service (run:
ordown:
)service_name:
is the name of the service for which status is returned(pid 12345)
is the process identifier12345s
is the uptime of the service, in seconds
For example:
down: opscode-erchef: (pid 35546) 10s
By default, runit will restart services automatically when the services
fail. Therefore, runit may report the status of a service as run:
even
when there is an issue with that service. When investigating why a
particular service is not running as it should be, look for the services
with the shortest uptimes. For example, the list below indicates that
the opscode-erchef should be investigated further:
run: oc-id
run: opscode-chef: (pid 4327) 13671s; run: log: (pid 4326) 13671s
run: opscode-erchef: (pid 5383) 5s; run: log: (pid 4382) 13669s
Log Files
A typical status line for a service that is running any of the Chef Infra Server front-end services is similar to the following:
run: name_of_service: (pid 1486) 7819s; run: log: (pid 1485) 7819s
where:
run
describes the state in which the supervisor attempts to keep processes. This state is eitherrun
ordown
. If a service is in adown
state, it should be stoppedname_of_service
is the service name, for example:opscode-erchef
(pid 1486) 7819s;
is the process identifier followed by the amount of time (in seconds) the service has been runningrun: log: (pid 1485) 7819s
is the log process. It is typical for a log process to have a longer run time than a service; this is because the supervisor does not need to restart the log process in order to connect the supervised process
If the service is down, the status line will appear similar to the following:
down: opscode-erchef: 3s, normally up; run: log: (pid 1485) 8526s
where
down
indicates that the service is in a down state3s, normally up;
indicates that the service is normally in a run state and that the supervisor would attempt to restart this service after a reboot
stop
The stop
subcommand is used to stop all services enabled on the Chef
Infra Server. This command can also be run for an individual service by
specifying the name of the service in the command.
This subcommand has the following syntax:
chef-server-ctl stop SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand. When a service is
successfully stopped the output should be similar to:
ok: down: service_name: 0s, normally up
For example:
chef-server-ctl stop
will return something similar to:
ok: down: nginx: 393s, normally up
ok: down: opscode-chef: 391s, normally up
ok: down: opscode-erchef: 391s, normally up
ok: down: opscode-solr4: 389s, normally up
ok: down: postgresql: 388s, normally up
ok: down: redis_lb: 387s, normally up
tail
The tail
subcommand is used to follow all of the Chef Infra Server
logs for all services. This command can also be run for an individual
service by specifying the name of the service in the command.
This subcommand has the following syntax:
chef-server-ctl tail SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
term
The term
subcommand is used to send a SIGTERM
to all services. This
command can also be run for an individual service by specifying the name
of the service in the command.
This subcommand has the following syntax:
chef-server-ctl term SERVICE_NAME
where SERVICE_NAME
represents the name of any service that is listed
after running the service-list
subcommand.
List of Services
The following services are part of the Chef Infra Server:
- bifrost
- bookshelf
- elasticsearch
- nginx
- opscode-erchef
- postgresql
- redis-lb
bifrost
The oc_bifrost service ensures that every request to view or manage objects stored on the Chef Infra Server is authorized.
status
To view the status for the service:
chef-server-ctl status bifrost
to return something like:
run: bifrost: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start bifrost
stop
To stop the service:
chef-server-ctl stop bifrost
restart
To restart the service:
chef-server-ctl restart bifrost
to return something like:
ok: run: bifrost: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill bifrost
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once bifrost
tail
To follow the logs for the service:
chef-server-ctl tail bifrost
bookshelf
The bookshelf service is an Amazon Simple Storage Service (S3)-compatible service that is used to store cookbooks, including all of the files—recipes, templates, and so on—that are associated with each cookbook.
status
To view the status for the service:
chef-server-ctl status bookshelf
to return something like:
run: bookshelf: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start bookshelf
stop
To stop the service:
chef-server-ctl stop bookshelf
restart
To restart the service:
chef-server-ctl restart bookshelf
to return something like:
ok: run: bookshelf: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill bookshelf
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once bookshelf
tail
To follow the logs for the service:
chef-server-ctl tail bookshelf
Elasticsearch
status
To view the status for the service:
chef-server-ctl status elasticsearch
to return something like:
elasticsearch: (pid 12345) 1s; run: log: (pid 5678) 123456s
start
To start the service:
chef-server-ctl start elasticsearch
to return something like:
ok: run: elasticsearch: (pid 5678) 0s
stop
To stop the service:
chef-server-ctl stop elasticsearch
to return something like:
ok: down: elasticsearch: 123456s, normally up
restart
To restart the service:
chef-server-ctl restart elasticsearch
to return something like:
ok: run: elasticsearch: (pid 56789) 1s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill elasticsearch
run once
chef-server-ctl once elasticsearch
tail
To follow the logs for the service:
chef-server-ctl tail elasticsearch
nginx
The nginx service is used to manage traffic to the Chef Infra Server, including virtual hosts for internal and external API request/response routing, external add-on request routing, and routing between front- and back-end components.
status
To view the status for the service:
chef-server-ctl status nginx
to return something like:
run: nginx: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start nginx
stop
To stop the service:
chef-server-ctl stop nginx
restart
To restart the service:
chef-server-ctl restart nginx
to return something like:
ok: run: nginx: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill nginx
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once nginx
tail
To follow the logs for the service:
chef-server-ctl tail nginx
opscode-erchef
The opscode-erchef service is an Erlang-based service that is used to handle Chef Infra Server API requests to the following areas within the Chef Infra Server:
- Cookbooks
- Data bags
- Environments
- Nodes
- Roles
- Sandboxes
- Search
status
To view the status for the service:
chef-server-ctl status opscode-erchef
to return something like:
run: opscode-erchefs: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start opscode-erchef
stop
To stop the service:
chef-server-ctl stop opscode-erchef
restart
To restart the service:
chef-server-ctl restart opscode-erchef
to return something like:
ok: run: opscode-erchef: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill opscode-erchef
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once opscode-erchef
tail
To follow the logs for the service:
chef-server-ctl tail opscode-erchef
postgresql
The postgresql service is used to store node, object, and user data.
status
To view the status for the service:
chef-server-ctl status postgresql
to return something like:
run: postgresql: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start postgresql
stop
To stop the service:
chef-server-ctl stop postgresql
restart
To restart the service:
chef-server-ctl restart postgresql
to return something like:
ok: run: postgresql: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill postgresql
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once postgresqls
tail
To follow the logs for the service:
chef-server-ctl tail postgresql
redis
Key-value store used in conjunction with Nginx to route requests and populate request data used by the Chef Infra Server.
status
To view the status for the service:
chef-server-ctl status redis
to return something like:
run: redis: (pid 1234) 123456s; run: log: (pid 5678) 789012s
start
To start the service:
chef-server-ctl start redis
stop
To stop the service:
chef-server-ctl stop redis
restart
To restart the service:
chef-server-ctl restart redis
to return something like:
ok: run: redis: (pid 1234) 1234s
kill
To kill the service (send a SIGKILL
command):
chef-server-ctl kill name_of_service
run once
To run the service, but not restart it (if the service fails):
chef-server-ctl once redis
tail
To follow the logs for the service:
chef-server-ctl tail name_of_service
Was this page helpful?