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

failed to start pd with the host name in topo.yaml #337

Closed
july2993 opened this issue Mar 24, 2020 · 3 comments · Fixed by #949 or #950
Closed

failed to start pd with the host name in topo.yaml #337

july2993 opened this issue Mar 24, 2020 · 3 comments · Fixed by #949 or #950
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@july2993
Copy link
Contributor

topo.yaml

tidb_servers:
  - host: n1
  - host: n2

pd_servers:
  - host: n3
  - host: n4
  - host: n5

tikv_servers:
  - host: n3
  - host: n4
  - host: n5

run deploy and start, failed to start pd

pd log:

[2020/03/24 16:27:17.759 +00:00] [INFO] [server.go:217] ["PD Config"] [config="{\"client-urls\":\"http://n3:2379\",\"peer-urls\":\"http://n3:2380\",\"advertise-client-urls\":\"http://n3:2379\",\"advertise-peer-urls\":\"http://n3:2380\",\"name\":\"pd-n3\",\"data-dir\":\"/home/tidb/deploy/pd-2379/data\",\"force-new-cluster\":false,\"enable-grpc-gateway\":true,\"initial-cluster\":\"pd-n3=http://n3:2380,pd-n4=http://n4:2380,pd-n5=http://n5:2380\",\"initial-cluster-state\":\"new\",\"join\":\"\",\"lease\":3,\"log\":{\"level\":\"\",\"format\":\"text\",\"disable-timestamp\":false,\"file\":{\"filename\":\"logs/pd.log\",\"max-size\":300,\"max-days\":0,\"max-backups\":0},\"development\":false,\"disable-caller\":false,\"disable-stacktrace\":false,\"disable-error-verbose\":true,\"sampling\":null},\"log-file\":\"\",\"log-level\":\"\",\"tso-save-interval\":\"3s\",\"metric\":{\"job\":\"pd-n3\",\"address\":\"\",\"interval\":\"15s\"},\"schedule\":{\"max-snapshot-count\":3,\"max-pending-peer-count\":16,\"max-merge-region-size\":20,\"max-merge-region-keys\":200000,\"split-merge-interval\":\"1h0m0s\",\"enable-one-way-merge\":\"false\",\"enable-cross-table-merge\":\"false\",\"patrol-region-interval\":\"100ms\",\"max-store-down-time\":\"30m0s\",\"leader-schedule-limit\":4,\"leader-schedule-policy\":\"count\",\"region-schedule-limit\":2048,\"replica-schedule-limit\":64,\"merge-schedule-limit\":8,\"hot-region-schedule-limit\":4,\"hot-region-cache-hits-threshold\":3,\"store-balance-rate\":15,\"tolerant-size-ratio\":0,\"low-space-ratio\":0.8,\"high-space-ratio\":0.6,\"scheduler-max-waiting-operator\":5,\"enable-remove-down-replica\":\"true\",\"enable-replace-offline-replica\":\"true\",\"enable-make-up-replica\":\"true\",\"enable-remove-extra-replica\":\"true\",\"enable-location-replacement\":\"true\",\"enable-debug-metrics\":\"false\",\"schedulers-v2\":[{\"type\":\"balance-region\",\"args\":null,\"disable\":false,\"args-payload\":\"\"},{\"type\":\"balance-leader\",\"args\":null,\"disable\":false,\"args-payload\":\"\"},{\"type\":\"hot-region\",\"args\":null,\"disable\":false,\"args-payload\":\"\"},{\"type\":\"label\",\"args\":null,\"disable\":false,\"args-payload\":\"\"}],\"schedulers-payload\":null,\"store-limit-mode\":\"manual\"},\"replication\":{\"max-replicas\":3,\"location-labels\":\"\",\"strictly-match-label\":\"false\",\"enable-placement-rules\":\"false\"},\"pd-server\":{\"use-region-storage\":\"true\",\"max-reset-ts-gap\":86400000000000,\"key-type\":\"table\",\"runtime-services\":\"\",\"metric-storage\":\"\"},\"cluster-version\":\"0.0.0\",\"quota-backend-bytes\":\"8GiB\",\"auto-compaction-mode\":\"periodic\",\"auto-compaction-retention-v2\":\"1h\",\"TickInterval\":\"500ms\",\"ElectionInterval\":\"3s\",\"PreVote\":true,\"security\":{\"cacert-path\":\"\",\"cert-path\":\"\",\"key-path\":\"\",\"client-cert-auth\":false,\"cert-allowed-cn\":null},\"label-property\":null,\"WarningMsgs\":null,\"DisableStrictReconfigCheck\":false,\"HeartbeatStreamBindInterval\":\"1m0s\",\"LeaderPriorityCheckInterval\":\"1m0s\",\"enable-dynamic-config\":true,\"EnableDashboard\":true}"]
[2020/03/24 16:27:17.780 +00:00] [INFO] [server.go:190] ["register REST path"] [path=/pd/api/v1]
[2020/03/24 16:27:17.787 +00:00] [INFO] [apiserver.go:109] ["Enabled Dashboard API"] [path=/dashboard/api/]
[2020/03/24 16:27:17.787 +00:00] [INFO] [server.go:190] ["register REST path"] [path=/dashboard/api/]
[2020/03/24 16:27:17.787 +00:00] [INFO] [uiserver.go:38] ["Enabled Dashboard UI"] [path=/dashboard/]
[2020/03/24 16:27:17.787 +00:00] [INFO] [server.go:190] ["register REST path"] [path=/dashboard/]
[2020/03/24 16:27:17.787 +00:00] [FATAL] [main.go:125] ["run server failed"] [error="expected IP in URL for binding (http://n3:2380)"] [stack="github.com/pingcap/log.Fatal\n\t/home/jenkins/agent/workspace/release_tidb_4.0/go/pkg/mod/github.com/pingcap/log@v0.0.0-20200117041106-d28c14d3b1cd/global.go:59\nmain.main\n\t/home/jenkins/agent/workspace/release_tidb_4.0/go/src/github.com/pingcap/pd/cmd/pd-server/main.go:125\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:203"]

note the error expected IP in URL for binding (http://n3:2380)

@nerijus
Copy link

nerijus commented May 6, 2020

I filed same issue tikv/pd#2373

@july2993
Copy link
Contributor Author

july2993 commented May 7, 2020

I filed same issue pingcap/pd#2373

It 's not supported now, you can use IP in the topo.

@nerijus
Copy link

nerijus commented May 7, 2020

I was able to deploy cluster using host names instead of IP addresses by patching /root/.tiup/components/cluster/v0.6.0/templates/scripts/run_pd.sh.tpl with:

--- run_pd.sh.tpl.orig  2020-05-05 09:19:37.668068422 +0000
+++ run_pd.sh.tpl       2020-05-07 09:41:10.083545459 +0000
@@ -22,13 +22,7 @@
 {{- else}}
 exec bin/pd-server \
 {{- end}}
-    --name="{{.Name}}" \
-    --client-urls="{{.Scheme}}://{{.IP}}:{{.ClientPort}}" \
-    --advertise-client-urls="{{.Scheme}}://{{.IP}}:{{.ClientPort}}" \
-    --peer-urls="{{.Scheme}}://{{.IP}}:{{.PeerPort}}" \
-    --advertise-peer-urls="{{.Scheme}}://{{.IP}}:{{.PeerPort}}" \
     --data-dir="{{.DataDir}}" \
-    --initial-cluster="{{template "PDList" .Endpoints}}" \
     --config=conf/pd.toml \
     --log-file="{{.LogDir}}/pd.log" 2>> "{{.LogDir}}/pd_stderr.log"

and by adding the following after every pd host in topology.yaml:

pd_servers:
  - host: n3
    config:
      name: "pd-n3-2379"
      client-urls: "https://0.0.0.0:2379"
      advertise-client-urls: "https://n3:2379"
      peer-urls: "https://0.0.0.0:2380"
      advertise-peer-urls: "https://n3:2380"
      initial-cluster: "pd-n3-2379=https://n3:2380,pd-n4-2379=https://n4:2380,pd-n5-2379=https://n5:2380"

Basically I moved all the custom config from run_pd.sh to pd.toml.
(I used https instead of http because I enabled TLS too; for it to work the following additions to topology.yaml are needed:

server_configs:
  tidb:
    security.ssl-ca: "./conf/sql-ca.pem"
    security.ssl-cert: "./conf/sql-server.pem"
    security.ssl-key: "./conf/sql-server.key"
    security.cluster-ssl-ca: "./conf/tidb-ca.pem"
    security.cluster-ssl-cert: "./conf/tidb-server.pem"
    security.cluster-ssl-key: "./conf/tidb-server.key"

  tikv:
    security.ca-path: "/opt/tidb/tikv-20160/conf/tidb-ca.pem"
    security.cert-path: "/opt/tidb/tikv-20160/conf/tidb-server.pem"
    security.key-path: "/opt/tidb/tikv-20160/conf/tidb-server.key"
  pd:
    security.cacert-path: "./conf/tidb-ca.pem"
    security.cert-path: "./conf/tidb-server.pem"
    security.key-path: "./conf/tidb-server.key"

)

@lonng lonng transferred this issue from another repository Jun 1, 2020
lucklove pushed a commit to lucklove/tiup that referenced this issue Jun 1, 2020
@july2993 july2993 added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jun 9, 2020
fln added a commit to fln/tiup that referenced this issue Nov 26, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 29, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This PR updates refactors integration tests to use host names instead of
IP addresses. It resolves pingcap#337.

All IP literals in the integration tests are replaced with host names
`n1` to `n5`.

This allows us to make integration test topology files immutable and
remove extra topology file templating step.

Extra topology file `full_scale_in_tidb_2nd.yaml` is introduced for
second tidb scaling operation to avoid topology file mutation during the
test.

Using host names in the integration tests will help us to maintain
compatibility with services declared using host names. There should be
no extra maintenance to support using IP addresses.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This PR updates refactors integration tests to use host names instead of
IP addresses. It resolves pingcap#337.

All IP literals in the integration tests are replaced with host names
`n1` to `n5`.

This allows us to make integration test topology files immutable and
remove extra topology file templating step.

Extra topology file `full_scale_in_tidb_2nd.yaml` is introduced for
second tidb scaling operation to avoid topology file mutation during the
test.

Using host names in the integration tests will help us to maintain
compatibility with services declared using host names. There should be
no extra maintenance to support using IP addresses.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This PR updates refactors integration tests to use host names instead of
IP addresses. It resolves pingcap#337.

All IP literals in the integration tests are replaced with host names
`n1` to `n5`.

This allows us to make integration test topology files immutable and
remove extra topology file templating step.

Extra topology file `full_scale_in_tidb_2nd.yaml` is introduced for
second tidb scaling operation to avoid topology file mutation during the
test.

Using host names in the integration tests will help us to maintain
compatibility with services declared using host names. There should be
no extra maintenance to support using IP addresses.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing pingcap#337.
fln added a commit to fln/tiup that referenced this issue Nov 30, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in pingcap#495 and is already used for
the --client-urls flag.

This should resolve pingcap#337 and partially implement pingcap#691.
ti-chi-bot pushed a commit that referenced this issue Dec 1, 2020
This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing #337.

Co-authored-by: SIGSEGV <gnu.crazier@gmail.com>
ti-chi-bot added a commit that referenced this issue Dec 1, 2020
This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in #495 and is already used for
the --client-urls flag.

This should resolve #337 and partially implement #691.

Co-authored-by: SIGSEGV <gnu.crazier@gmail.com>
Co-authored-by: Ti Prow Robot <71242396+ti-community-prow-bot@users.noreply.github.com>
ti-chi-bot pushed a commit that referenced this issue Dec 8, 2020
* Support host names in TLS certificates

This commit updates TLS certificate generator to detect if IP address or
host name was used as host value. If host name is detected field `DNSNames`
of x509 SAN extenstion is used instead of `IPAddresses`.

* https://en.wikipedia.org/wiki/Subject_Alternative_Name
* https://tools.ietf.org/html/rfc5280#section-4.2.1.6

This contributes towards fixing #337.

* Fix PD --peer-urls flag to use listen_host variable

This commit updates run_pd.sh template to use `listen_host` for
--peer-urls flag instead of `host`.

This allows us to use server hostname instead of IP addresse. Without
this change if PD service is declared using hostname it fails to start,
reporting an error that it can not bind to given interface.

Metadata variable `listen_host` was introduced in #495 and is already used for
the --client-urls flag.

This should resolve #337 and partially implement #691.

* Switch to host names in integration tests

This PR updates refactors integration tests to use host names instead of
IP addresses. It resolves #337.

All IP literals in the integration tests are replaced with host names
`n1` to `n5`.

This allows us to make integration test topology files immutable and
remove extra topology file templating step.

Extra topology file `full_scale_in_tidb_2nd.yaml` is introduced for
second tidb scaling operation to avoid topology file mutation during the
test.

Using host names in the integration tests will help us to maintain
compatibility with services declared using host names. There should be
no extra maintenance to support using IP addresses.

Co-authored-by: SIGSEGV <gnu.crazier@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
2 participants