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

Consul agent ignoring -client flag #3397

Closed
Theaxiom opened this issue Aug 16, 2017 · 5 comments
Closed

Consul agent ignoring -client flag #3397

Theaxiom opened this issue Aug 16, 2017 · 5 comments
Assignees
Milestone

Comments

@Theaxiom
Copy link

consul version for both Client and Server

Client: 0.9.0
Server: 0.9.0

consul info for both Client and Server

Client:

[ansible@devtop2-1 ~]$ consul info
agent:
	check_monitors = 0
	check_ttls = 0
	checks = 0
	services = 0
build:
	prerelease =
	revision = b79d951
	version = 0.9.0
consul:
	known_servers = 1
	server = false
runtime:
	arch = amd64
	cpu_count = 1
	goroutines = 33
	max_procs = 1
	os = linux
	version = go1.8.3
serf_lan:
	coordinate_resets = 0
	encrypted = false
	event_queue = 0
	event_time = 3
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 18
	members = 4
	query_queue = 0
	query_time = 1

Server:

[ansible@devops ~]$ consul info
agent:
	check_monitors = 0
	check_ttls = 0
	checks = 0
	services = 2
build:
	prerelease =
	revision = b79d951
	version = 0.9.0
consul:
	bootstrap = true
	known_datacenters = 1
	leader = true
	leader_addr = 10.0.3.10:8300
	server = true
raft:
	applied_index = 62898
	commit_index = 62898
	fsm_pending = 0
	last_contact = 0
	last_log_index = 62898
	last_log_term = 3
	last_snapshot_index = 57346
	last_snapshot_term = 3
	latest_configuration = [{Suffrage:Voter ID:10.0.3.10:8300 Address:10.0.3.10:8300}]
	latest_configuration_index = 1
	num_peers = 0
	protocol_version = 2
	protocol_version_max = 3
	protocol_version_min = 0
	snapshot_version_max = 1
	snapshot_version_min = 0
	state = Leader
	term = 3
runtime:
	arch = amd64
	cpu_count = 8
	goroutines = 81
	max_procs = 8
	os = linux
	version = go1.8.3
serf_lan:
	coordinate_resets = 0
	encrypted = false
	event_queue = 0
	event_time = 3
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 18
	members = 4
	query_queue = 0
	query_time = 1
serf_wan:
	coordinate_resets = 0
	encrypted = false
	event_queue = 0
	event_time = 1
	failed = 0
	health_score = 0
	intent_queue = 0
	left = 0
	member_time = 1
	members = 1
	query_queue = 0
	query_time = 1

Operating system and Environment details

RHEL 7

Description of the Issue (and unexpected/desired result)

When passing the -client=10.0.3.11 flag and specifying client_addr: "10.0.3.11" in the config file, it is still binding client to 127.0.0.1

Reproduction steps

  1. Install Consul 0.9.0
  2. Setup server
  3. Setup client with following command: SCREEN consul agent -data-dir=/tmp/consul -node=agent-two -bind=10.0.3.11 enable-script-checks=true -config-dir=/etc/consul.d -client=10.0.3.11
@magiconair
Copy link
Contributor

I'll have a look

@magiconair magiconair self-assigned this Aug 16, 2017
@magiconair
Copy link
Contributor

Hmm, I can't reproduce this or I don't understand your setup. I did this:

# create config file
echo '{"client_addr":"192.168.33.1"}' > c.json

# start consul agent
consul agent -dev -bind 192.168.33.1 -client 192.168.33.1
consul agent -dev -bind 192.168.33.1 -config-file c.json
consul agent -dev -bind 192.168.33.1 -client 192.168.33.1 -config-file c.json
consul agent -dev -bind 192.168.33.1 -config-file c.json -client 192.168.33.1

# check for bound client ports
lsof -i -n -P | grep consul | grep 8[56]00
consul    93140 frank   10u  IPv4 0xc6d3f391b071e5d7      0t0  UDP 192.168.33.1:8600
consul    93140 frank   11u  IPv4 0xc6d3f391c0719b0f      0t0  TCP 192.168.33.1:8600 (LISTEN)
consul    93140 frank   12u  IPv4 0xc6d3f391bcad1027      0t0  TCP 192.168.33.1:8500 (LISTEN)

What am I missing?

@Theaxiom
Copy link
Author

I have -client=10.0.3.11 not -client 10.0.3.11 -- let me try your way and see if it is resolved.

@Theaxiom
Copy link
Author

I found the issue, I was missing - before enable-script-checks=true. It was a syntax error and obviously it gave me no error output regarding the mistake. Is that a bug?

@magiconair
Copy link
Contributor

I'll have a look. Will touch that code soon anyway. Glad you've found it.

magiconair added a commit that referenced this issue Oct 20, 2017
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
@magiconair magiconair added this to the 1.0.1 milestone Oct 20, 2017
magiconair added a commit that referenced this issue Oct 23, 2017
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
magiconair added a commit that referenced this issue Oct 23, 2017
The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
magiconair added a commit that referenced this issue Oct 23, 2017
…lags

The `consul agent` command was ignoring extra command line arguments
which can lead to confusion when the user has for example forgotten to
add a dash in front of an argument or is not using an `=` when setting
boolean flags to `true`. `-bootstrap true` is not the same as
`-bootstrap=true`, for example.

Since all command line flags are known and we don't expect unparsed
arguments we can return an error. However, this may make it slightly
more difficult in the future if we ever wanted to have these kinds of
arguments.

Fixes #3397
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