shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

sharding-proxy is wrong to use nacos.

Open geomonlin opened this issue 7 years ago • 7 comments

Bug Report Which version of ShardingSphere did you use? 4.0.0-RC3-SNAPSHOT

Which project did you use? Sharding-JDBC or Sharding-Proxy? Sharding-proxy

Expected behavior Write configured into nacos should correct。

NacosRegistryCenter.getDirectly(final String key)->configService.getConfig(dataId, group, timeoutMs) is not null.

Actual behavior

[INFO ] 19:39:31.676 [main] o.a.s.core.util.ConfigurationLogger - ShardingRuleConfiguration
bindingTables:
- t_order,t_order_item
defaultDatabaseStrategy:
  inline:
    algorithmExpression: ds_${user_id % 2}
    shardingColumn: user_id
tables:
  t_order:
    actualDataNodes: ds_${0..1}.t_order_${0..1}
    keyGenerator:
      column: order_id
      type: SNOWFLAKE
    logicTable: t_order
    tableStrategy:
      inline:
        algorithmExpression: t_order_${order_id % 2}
        shardingColumn: order_id
  t_order_item:
    actualDataNodes: ds_${0..1}.t_order_item_${0..1}
    keyGenerator:
      column: order_item_id
      type: SNOWFLAKE
    logicTable: t_order_item
    tableStrategy:
      inline:
        algorithmExpression: t_order_item_${order_id % 2}
        shardingColumn: order_id

[INFO ] 19:39:35.978 [main] o.a.s.core.util.ConfigurationLogger - Authentication
users:
  root:
    authorizedSchemas: ''
  sharding:
    authorizedSchemas: ''
    password: sharding

[INFO ] 19:39:35.979 [main] o.a.s.core.util.ConfigurationLogger - Properties
executor.size: 16
proxy.transaction.type: LOCAL
sql.show: true
proxy.opentracing.enabled: false
query.with.cipher.column: true
proxy.frontend.flush.threshold: 128
acceptor.size: 16
max.connections.size.per.query: 1
proxy.hint.enabled: false

Exception in thread "main" java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:210)
	at com.google.common.base.Joiner.toString(Joiner.java:433)
	at com.google.common.base.Joiner.appendTo(Joiner.java:111)
	at com.google.common.base.Joiner.appendTo(Joiner.java:152)
	at com.google.common.base.Joiner.join(Joiner.java:193)
	at com.google.common.base.Joiner.join(Joiner.java:183)
	at com.google.common.base.Joiner.join(Joiner.java:209)
	at org.apache.shardingsphere.orchestration.internal.registry.config.node.ConfigurationNode.getFullPath(ConfigurationNode.java:97)
	at org.apache.shardingsphere.orchestration.internal.registry.config.node.ConfigurationNode.getDataSourcePath(ConfigurationNode.java:65)
	at org.apache.shardingsphere.orchestration.internal.registry.config.service.ConfigurationService.loadDataSourceConfigurations(ConfigurationService.java:197)
	at org.apache.shardingsphere.shardingproxy.Bootstrap.getSchemaDataSourceParameterMap(Bootstrap.java:127)
	at org.apache.shardingsphere.shardingproxy.Bootstrap.startWithRegistryCenter(Bootstrap.java:116)
	at org.apache.shardingsphere.shardingproxy.Bootstrap.main(Bootstrap.java:83)

geomonlin avatar Oct 24 '19 11:10 geomonlin

Hi, They are some PRs maybe can clear up your confusion. (https://github.com/apache/incubator-shardingsphere/pull/3354, https://github.com/apache/incubator-shardingsphere/pull/3150) As you know, Nacos registry center can not support proxy util now. Are you interest in this ?

sunbufu avatar Dec 04 '19 10:12 sunbufu

@huangjian888 Hi, guy. I have some questions on nacos registry center, can you help me? This is my email [email protected]. Waiting for your replay :)

sunbufu avatar Dec 04 '19 11:12 sunbufu

Sharding proxy needs to be configured in Nacos in advance.(#3354)

huangjian888 avatar Dec 04 '19 11:12 huangjian888

Config-sharding.yaml ->schemaName: sharding_db schemaName field value needs to be configured to Nacos in advance.

huangjian888 avatar Dec 04 '19 11:12 huangjian888

Configure .orchestration_ds.config.schema field to Nacos configuration center such as:key->.orchestration_ds.config.schema value-> schemaName1, schemaName2, schemaName3

huangjian888 avatar Dec 04 '19 11:12 huangjian888

@huangjian888 hi, can i have your WeChat id? I have some other questions want to discuss with you. 😁

sunbufu avatar Dec 04 '19 14:12 sunbufu

reference #4260 .

Now, nacos can be used as ConfigCenter, but not support RegistryCenter.

dongzl avatar Feb 19 '20 10:02 dongzl