Hi. I’m trying to create a Sensu cluster as a proof of concept.
I’m trying to set up this locally on my computer by using “Docker Desktop”.
When using the example command line to start sensu, it works without issue (Note: due to forum rules about only having two links, I have replaced “http://” with “<http>”):
sensu-backend start --etcd-listen-client-urls 0.0.0.0:2379 --etcd-name backend1 --etcd-advertise-client-urls backend1:2379 --etcd-initial-cluster backend1=backend1:2380,backend2=backend2:2380,backend3=backend3:2380 --etcd-initial-cluster-state new --etcd-initial-advertise-peer-urls backend1:2380 --state-dir /var/lib/sensu/sensu-backend/etcd1 --etcd-listen-peer-urls 0.0.0.0:2380 --log-level debug --debug
The problems arise when I’m trying to use a configuration file. I have copied the values from the command line into the configuration file and then I execute with the following command:
sensu-backend start --log-level debug --config-file “/etc/sensu/backend.yml”
My configuration file looks like this (I have removed some comments to make it easier to read):
config-file: “/etc/sensu/backend.yml”
log-level: “debug” #available log levels: panic, fatal, error, warn, info, debug, trace
state-dir: “/var/lib/sensu/sensu-backend/etcd1”etcd-advertise-client-urls:
- backend1:2379etcd-initial-advertise-peer-urls:
- backend1:2380etcd-initial-cluster: “backend1=backend1:2380,backend2=backend2:2380,backend3=backend3:2380”
etcd-initial-cluster-state: “new”
etcd-listen-client-urls:
- 0.0.0.0:2379etcd-listen-peer-urls:
- 0.0.0.0:2380etcd-name: “backend1”
When executing this, it doesn’t work. These are the logs I get from my sensu-backend (I have removed timestamps):
{
“component”:“cmd”,
“level”:“info”,
“msg”:“attempting to connect to etcd server: backend1:2379”
}
{
“component”:“etcd”,
“level”:“info”,
“caller”:“embed/etcd.go:124”,
“msg”:“configuring peer listeners”,
“listen-peer-urls”:[“[::]:2380”]
}
{
“component”:“etcd”,
“level”:“info”,
“caller”:“embed/etcd.go:132”,
“msg”:“configuring client listeners”,
“listen-client-urls”:[“[::]:2379”]
}
{
“component”:“etcd”,“level”:“info”,
“caller”:“embed/etcd.go:306”,
“msg”:“starting an etcd server”,
“etcd-version”:“3.5.5”,
“git-sha”:“Not provided (use ./build instead of go build)”,
“go-version”:“go1.18.10”,
“go-os”:“linux”,
“go-arch”:“amd64”,
“max-cpu-set”:12,
“max-cpu-available”:12,
“member-initialized”:false,
“name”:“backend1”,
“data-dir”:“/var/lib/sensu/sensu-backend/etcd1/etcd/data”,
“wal-dir”:“/var/lib/sensu/sensu-backend/etcd1/etcd/wal”,
“wal-dir-dedicated”:“/var/lib/sensu/sensu-backend/etcd1/etcd/wal”,
“member-dir”:“/var/lib/sensu/sensu-backend/etcd1/etcd/data/member”,
“force-new-cluster”:false,
“heartbeat-interval”:“300ms”,
“election-timeout”:“3s”,
“initial-election-tick-advance”:true,
“snapshot-count”:100000,
“snapshot-catchup-entries”:5000,
“initial-advertise-peer-urls”:[“backend1:2380”],
“listen-peer-urls”:[“[::]:2380”],
“advertise-client-urls”:[“backend1:2379”],
“listen-client-urls”:[“[::]:2379”],
“listen-metrics-urls”:,“cors”:[““],“host-whitelist”:[””],
“initial-cluster”:“default=backend1:2380”,
“initial-cluster-state”:“new”,“initial-cluster-token”:“etcd-cluster”,
“quota-backend-bytes”:4294967296,“max-request-bytes”:1572864,“max-concurrent-streams”:4294967295,
“pre-vote”:true,“initial-corrupt-check”:false,“corrupt-check-time-interval”:“0s”,
“compact-check-time-enabled”:false,
“compact-check-time-interval”:“1m0s”,
“auto-compaction-mode”:“revision”,
“auto-compaction-retention”:“2ns”,
“auto-compaction-interval”:“2ns”,
“discovery-url”:“”,
“discovery-proxy”:“”,
“downgrade-check-interval”:“5s”
}
{
“etcd”,“level”:“info”,
“caller”:“etcdserver/backend.go:81”,
“msg”:“opened backend db”,
“path”:“/var/lib/sensu/sensu-backend/etcd1/etcd/data/member/snap/db”,
“took”:“4.468613ms”
}
{
“etcd”,
“level”:“info”,
“caller”:“embed/etcd.go:371”,
“msg”:“closing etcd server”,
“name”:“backend1”,
“data-dir”:“/var/lib/sensu/sensu-backend/etcd1/etcd/data”,
“advertise-peer-urls”:[“backend1:2380”],
“advertise-client-urls”:[“backend1:2379”]
}
{
“etcd”,
“level”:“info”,
“caller”:“embed/etcd.go:373”,
“msg”:“closed etcd server”,
“name”:“backend1”,
“data-dir”:“/var/lib/sensu/sensu-backend/etcd1/etcd/data”,
“advertise-peer-urls”:[“backend1:2380”],
“advertise-client-urls”:[“backend1:2379”]
}
{
“sensu-enterprise”,
“error”:“error starting etcd: couldn’t find local name "backend1" in the initial cluster configuration”,
“level”:“fatal”,
“msg”:“error executing sensu-backend”
}
I am struggling to identify what’s wrong with the configuration file and I do not understand the “couldn’t find local name” error. What could be wrong with the configuration file? Any insights would be greatly appreciated.