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

PD cluster failed to respond #3

Open
uahic opened this issue Jan 22, 2023 · 5 comments
Open

PD cluster failed to respond #3

uahic opened this issue Jan 22, 2023 · 5 comments

Comments

@uahic
Copy link

uahic commented Jan 22, 2023

Hi there,

I'm new to surrealDB, tikz and all the database world, trying to get the docker-compose setup here to work.
For some reason it seems that the tikv instances cant reach the pd instances. Did anyone ran into the same issue before?

surrealdb-pd1 | 2023-01-22 12:07:42.679445 W | etcdserver: could not get cluster response from http://pd2:2380: Get "http://pd2:2380/members": dial tcp 172.27.0.5:2380: connect: connection refused
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::iam Root authentication is enabled
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::iam Root username is 'root'
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::dbs Database strict mode is enabled
surrealdb     | [2023-01-22 12:07:43] INFO  surrealdb::kvs Connecting to kvs store at tikv://pd0:2379
surrealdb     | [2023-01-22 12:07:44] INFO  surrealdb::kvs Connected to kvs store at tikv://pd0:2379
surrealdb     | [2023-01-22 12:07:44] ERROR surrealdb::cli There was a problem with the database: There was a problem with the underlying datastore: [/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tikv-client-pd-0.1.0/src/cluster.rs:174]: PD cluster failed to respond

docker images

pingcap/pd                 v6.1.0     a2227c6c7298   7 months ago    150MB
pingcap/tikv               v6.1.0     50813a53fbec   7 months ago    438MB
surrealdb/surrealdb        latest     1fdaf659c2c4   3 months ago    50.7MB

The following docker-compose.yaml is simply called via docker-compose up

version: '3.8'

services:

  pd0:
    container_name: surrealdb-pd0
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd0
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd0:2379
      - --advertise-peer-urls=http://pd0:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd0
      - --log-file=/logs/pd0.log
    restart: on-failure

  pd1:
    container_name: surrealdb-pd1
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd1
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd1:2379
      - --advertise-peer-urls=http://pd1:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd1
      - --log-file=/logs/pd1.log
    restart: on-failure

  pd2:
    container_name: surrealdb-pd2
    image: pingcap/pd:v6.1.0
    ports:
      - "2379"
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --name=pd2
      - --client-urls=http://0.0.0.0:2379
      - --peer-urls=http://0.0.0.0:2380
      - --advertise-client-urls=http://pd2:2379
      - --advertise-peer-urls=http://pd2:2380
      - --initial-cluster=pd0=http://pd0:2380,pd1=http://pd1:2380,pd2=http://pd2:2380
      - --data-dir=/data/pd2
      - --log-file=/logs/pd2.log
    restart: on-failure

  tikv0:
    container_name: surrealdb-tikv0
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv0:20160
      - --data-dir=/data/tikv0
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv0.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  tikv1:
    container_name: surrealdb-tikv1
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv1:20160
      - --data-dir=/data/tikv1
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv1.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  tikv2:
    container_name: surrealdb-tikv2
    image: pingcap/tikv:v6.1.0
    volumes:
      - ${SURREAL_DB_PATH}/data:/data
      - ${SURREAL_DB_PATH}/logs:/logs
    command:
      - --addr=0.0.0.0:20160
      - --advertise-addr=tikv2:20160
      - --data-dir=/data/tikv2
      - --pd=pd0:2379,pd1:2379,pd2:2379
      - --log-file=/logs/tikv2.log
    depends_on:
      - "pd0"
      - "pd1"
      - "pd2"
    restart: on-failure

  prometheus:
    container_name: surrealdb-prometheus
    image: prom/prometheus:v2.2.1
    user: root
    command:
      - --log.level=error
      - --storage.tsdb.path=/data/prometheus
      - --config.file=/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
    volumes:
      - ${SURREAL_DB_PATH}/config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - ${SURREAL_DB_PATH}/config/pd.rules.yml:/etc/prometheus/pd.rules.yml:ro
      - ${SURREAL_DB_PATH}/config/tikv.rules.yml:/etc/prometheus/tikv.rules.yml:ro
      - ${SURREAL_DB_PATH}/config/tidb.rules.yml:/etc/prometheus/tidb.rules.yml:ro
      - ${SURREAL_DB_PATH}/data:/data
    restart: on-failure
    profiles:
      - monitoring

  grafana:
    image: grafana/grafana:6.0.1
    container_name: surrealdb-grafana
    user: "0"
    environment:
      GF_LOG_LEVEL: error
      GF_PATHS_PROVISIONING: /etc/grafana/provisioning
      GF_PATHS_CONFIG: /etc/grafana/grafana.ini
    volumes:
      - ${SURREAL_DB_PATH}/config/grafana:/etc/grafana
      - ${SURREAL_DB_PATH}/config/dashboards:/tmp/dashboards
      - ${SURREAL_DB_PATH}/data/grafana:/var/lib/grafana
    ports:
      - "3000:3000"
    restart: on-failure
    profiles:
      - monitoring

  surrealdb:
    image: surrealdb/surrealdb:latest
    container_name: surrealdb
    ports:
      - "8000:8000"
    command: 
      - start
      - --log=trace
      - --user=${SURREAL_ROOT_USER}
      - --pass=${SURREAL_ROOT_PASSWORD}
      - --strict
      - tikv://pd0:2379
    depends_on:
      - tikv0
      - tikv1
      - tikv2
    restart: always

  # minio:
  #   image: minio/minio
  #   ports:
  #     - "9098:9098"
  #     - "9099:9099"
  #   volumes:
  #     # - minio_storage:/data
  #     - ${MINIO_DB_PATH}:/data
  #   environment:
  #     MINIO_ROOT_USER: ${MINIO_ROOT_USER} 
  #     MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} 
  #   command: server --console-address ":9099" /data

# volumes:
#   minio_storage: {}

@uahic uahic closed this as completed Jan 22, 2023
@uahic uahic reopened this Jan 22, 2023
@ManAnRuck
Copy link

I have the same issue :/
Running on mac with silicon chip

@sgirones
Copy link

we recently published this Kubernetes guide: https://surrealdb.com/docs/deployment/kubernetes

I encourage you to use that guide to run a SurrealDB + TiKV cluster locally

@0xDjole
Copy link

0xDjole commented Sep 27, 2023

Having same issues with Kubernetes

@4F2E4A2E
Copy link

At least for me, the setup with tikv using rancher / traefik as ingress did not work, but with nginx.
I used a virtual node to be able to deploy it on a rancher / k8s using traefik as ingress.

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

5 participants