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

Add --run-worker to distinguish it from running without supervisor #1033

Merged
merged 3 commits into from
Jun 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/fluent/command/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,15 @@
opts[:daemonize] = s
}

op.on('--no-supervisor', "run without fluent supervisor") {
op.on('--under-supervisor', "run fluent worker under supervisor (this option is NOT for users)") {
opts[:supervise] = false
}

op.on('--no-supervisor', "run fluent worker without supervisor") {
opts[:supervise] = false
opts[:standalone_worker] = true
}

op.on('--user USER', "change user") {|s|
opts[:chuser] = s
}
Expand Down
11 changes: 10 additions & 1 deletion lib/fluent/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def self.default_options
without_source: false,
use_v1_config: true,
supervise: true,
standalone_worker: false,
signame: nil,
winsvcreg: nil,
}
Expand All @@ -319,6 +320,7 @@ def self.default_options
def initialize(opt)
@daemonize = opt[:daemonize]
@supervise = opt[:supervise]
@standalone_worker= opt[:standalone_worker]
@config_path = opt[:config_path]
@inline_config = opt[:inline_config]
@use_v1_config = opt[:use_v1_config]
Expand Down Expand Up @@ -381,6 +383,7 @@ def run_worker
$log.info "starting fluentd-#{Fluent::VERSION} without supervision"

main_process do
create_socket_manager if @standalone_worker
change_privilege
init_engine
run_configure
Expand All @@ -391,6 +394,12 @@ def run_worker

private

def create_socket_manager
socket_manager_path = ServerEngine::SocketManager::Server.generate_path
ServerEngine::SocketManager::Server.open(socket_manager_path)
ENV['SERVERENGINE_SOCKETMANAGER_PATH'] = socket_manager_path.to_s
end

def dry_run
$log.info "starting fluentd-#{Fluent::VERSION} as dry run mode"
change_privilege
Expand Down Expand Up @@ -444,7 +453,7 @@ def supervise
}
end

fluentd_spawn_cmd << ("--no-supervisor")
fluentd_spawn_cmd << ("--under-supervisor")
$log.info "spawn command to main: " + fluentd_spawn_cmd

params = {}
Expand Down