apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.8k stars 6.7k forks source link

shardingsphere-proxy start fail #14543

Closed xcmonline closed 2 years ago

xcmonline commented 2 years ago

Starting the ShardingSphere-Proxy ... Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/shardingsphere/mode/repository/cluster/ClusterPersistRepositoryConfiguration at org.apache.shardingsphere.mode.manager.cluster.yaml.ClusterPersistRepositoryConfigurationYamlSwapper.swapToObject(ClusterPersistRepositoryConfigurationYamlSwapper.java:41) at org.apache.shardingsphere.mode.manager.cluster.yaml.ClusterPersistRepositoryConfigurationYamlSwapper.swapToObject(ClusterPersistRepositoryConfigurationYamlSwapper.java:27) at org.apache.shardingsphere.infra.yaml.config.swapper.mode.PersistRepositoryConfigurationYamlSwapperEngine.swapToObject(PersistRepositoryConfigurationYamlSwapperEngine.java:57) at org.apache.shardingsphere.infra.yaml.config.swapper.mode.ModeConfigurationYamlSwapper.swapToObject(ModeConfigurationYamlSwapper.java:44) at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:67) at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:47) Caused by: java.lang.ClassNotFoundException: org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)

server.ymal ` scaling: blockQueueSize: 10000 workerThread: 40 clusterAutoSwitchAlgorithm: type: IDLE props: incremental-task-idle-minute-threshold: 30 dataConsistencyCheckAlgorithm: type: DEFAULT

mode: type: Cluster repository: type: ZooKeeper props: namespace: governance_ds server-lists: localhost:2181 retryIntervalMilliseconds: 500 timeToLiveSeconds: 60 maxRetries: 3 operationTimeoutMilliseconds: 500 overwrite: true

rules:

props: max-connections-size-per-query: 1 kernel-executor-size: 16
proxy-frontend-flush-threshold: 128
proxy-opentracing-enabled: false proxy-hint-enabled: false sql-show: false check-table-metadata-enabled: false show-process-list-enabled: false proxy-backend-query-fetch-size: -1 check-duplicate-table-enabled: false sql-comment-parse-enabled: false proxy-frontend-executor-size: 0 proxy-backend-executor-suitable: OLAP proxy-frontend-max-connections: 0 sql-federation-enabled: false `

config-sharding.ymal ` schemaName: sharding_db

dataSources: ds_0: url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useSSL=false username: root password: 123456 connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50 minPoolSize: 1

rules:

zhaojinchao95 commented 2 years ago

@xcmonline Hello, Can you tell me your ShardingSphere-Proxy version?

xcmonline commented 2 years ago

@xcmonline

apache-shardingsphere-5.0.0-shardingsphere-proxy windows 10

xcmonline commented 2 years ago

only setting. server.ymal

mode:
  type: Cluster
  repository:
    type: Zookeeper
    props:
      namespace: qiyun_db1
      server-lists: localhost:2181
  overwrite: true
rules:
  - !AUTHORITY
    users:
      - root@%:123456
    provider:
      type: ALL_PRIVILEGES_PERMITTED
props:
  max-connections-size-per-query: 1
  kernel-executor-size: 16
  proxy-frontend-flush-threshold: 128
  proxy-opentracing-enabled: false
  proxy-hint-enabled: false
  sql-show: false
  check-table-metadata-enabled: false

and

config-sharding.yaml

schemaName: testdb
dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useSSL=false
    username: root
    password: xxxxxx
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
rules:
- !SHARDING
  tables:
    obs_aws_data_min:
      actualDataNodes: ds_0.obs_aws_data_min_${0..1}
      tableStrategy:
        standard:
          shardingColumn: observ_time
          shardingAlgorithmName: sharding_by_time
      keyGenerateStrategy:
        column: id
        keyGeneratorName: snowflake
  defaultDatabaseStrategy:
    none:
  defaultTableStrategy:
    none:
  shardingAlgorithms:
    sharding_by_time:
      type: auto_interval
      props:
        datetime-lower: "2020-10-01 00:00:00"
        sharding-seconds: "86400"
        datetime-upper: "2020-10-05 00:00:00"
  keyGenerators:
    snowflake:
      type: SNOWFLAKE
      props:
        worker-id: 123
zhaojinchao95 commented 2 years ago

@xcmonline Can you check your ${shardingsphere-proxy}/lib directory. Are shardingsphere-cluster-mode-repository-zookeeper-curator.5.0.0.jar in it?

xcmonline commented 2 years ago

@xcmonline Can you check your ${shardingsphere-proxy}/lib directory. Are shardingsphere-cluster-mode-repository-zookeeper-curator.5.0.0.jar in it?

zookeeper-3.6.0.jar and zookeeper-jute-3.6.0.jar . shardingsphere-cluster-mode-repository-zookeeper-curator.5.0.0.jar not found, where can I download it.

terrymanu commented 2 years ago

The Github IT is run every pull request, please check your environment.

THMAIL commented 2 years ago

you can download it with https://mavenlibs.com/jar/file/org.apache.shardingsphere/shardingsphere-cluster-mode-repository-zookeeper-curator#all_versions, but I have tried it doesn't work at all !!!!