shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

How to use jdbc and shardingproxy together with zookeeper?

Open lwtdev opened this issue 6 years ago • 3 comments

Question

First , I use shardingsphere-proxy start with zookeeper. and create some schemas.

[zk: localhost:2181(CONNECTED) 31] ls /governance_ds/schemas
[ spsqltest_nosharding, spsqltest_sharding, test]

Then, I use shardingsphere-jdbc with zookeeper, but don't know how to configure a init schema. Try to configure shardingshpere-jdbc like this:

governance:
  name: governance_ds
  registryCenter:
    type: ZooKeeper
    serverLists: localhost:2181
  overwrite: false

but jdbc just use a default schema logic_db.

[zk: localhost:2181(CONNECTED) 32] ls /governance_ds/schemas
[logic_db, spsqltest_nosharding, spsqltest_sharding, test]

lwtdev avatar Oct 28 '20 09:10 lwtdev

Which version of the shardingjdbc and shardingproxy?

avalon5666 avatar Oct 29 '20 00:10 avalon5666

@avalon5666 5.0.0-RC1

lwtdev avatar Oct 29 '20 02:10 lwtdev

Hi, @lwtdev

A proxy is as a mysql instance, so it contains multiple databases( as logic database ). But a sharding-jdbc application is only as a SINGLE database, so it's SPECIFIED a name "logic_db".

That's the way "logic_db" designed.

Originally posted by @kimmking in https://github.com/apache/shardingsphere/issues/7939#issuecomment-717683164

integrate jdbc and proxy, you should just consider proxy as a REAL mysql server.

kimmking avatar Oct 29 '20 06:10 kimmking