liuxiaocs7 opened a new issue, #24874:
URL: https://github.com/apache/shardingsphere/issues/24874

   ## Question
   
   Hello, community, I try to use the new cdc feature, but it cannot be used 
normally, the steps are as follows:
   
   First i use `apache-shardingsphere-5.3.1-shardingsphere-proxy-bin`, conf:
   
   ```yaml
   mode:
    type: Cluster
    repository:
      type: ZooKeeper
      props:
        namespace: governance_ds
        server-lists: localhost:2181
        retryIntervalMilliseconds: 500
        timeToLiveSeconds: 60
        maxRetries: 3
        operationTimeoutMilliseconds: 500
   
   authority:
     users:
       - user: root@%
         password: root
     privilege:
       type: ALL_PERMITTED
   
   cdc:
     enabled: true
     port: 33071
   ```
   
   sharding conf:
   
   ```yaml
   databaseName: sharding_db
   
   dataSources:
    ds_0:
      url: jdbc:mysql://127.0.0.1:3306/sparktest?serverTimezone=UTC&useSSL=false
      username: root
      password: lx123456
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
   ```
   
   ShardingSphere Proxy runs successfully
   
   ```shell
   - special exclusive bonus offers not available to others
   - everything you need to get the most out of using Atomikos!
   [INFO ] 2023-03-28 11:43:09.579 [main] o.apache.curator.utils.Compatibility 
- Using org.apache.zookeeper.server.quorum.MultipleAddresses
   [INFO ] 2023-03-28 11:43:09.591 [main] o.a.s.d.p.c.e.PipelineJobWorker - 
start worker initialization
   [INFO ] 2023-03-28 11:43:09.598 [main] o.a.s.d.p.c.e.PipelineJobWorker - 
worker initialization done
   [INFO ] 2023-03-28 11:43:09.642 [main] o.a.s.p.v.ShardingSphereProxyVersion 
- Database name is `MySQL`, version is `8.0.26`, database name is `sharding_db`
   Thanks for using Atomikos! This installation is not registered yet.
   REGISTER FOR FREE at http://www.atomikos.com/Main/RegisterYourDownload and 
receive:
   - tips & advice
   - working demos
   - access to the full documentation
   - special exclusive bonus offers not available to others
   - everything you need to get the most out of using Atomikos!
   [INFO ] 2023-03-28 11:43:10.497 [main] o.a.s.p.frontend.ShardingSphereProxy 
- ShardingSphere-Proxy Cluster mode started successfully
   ```
   
   But when i run Bootstrap under `pipeline/cdc/example`
   
   ```java
   public static void main(final String[] args) {
       StartCDCClientParameter parameter = new StartCDCClientParameter(records 
-> log.info("records: {}", records));
       parameter.setAddress("127.0.0.1");
       parameter.setPort(33071);
       parameter.setUsername("root");
       parameter.setPassword("root");
       parameter.setDatabase("sharding_db");
       parameter.setFull(true);
       
parameter.setSchemaTables(Collections.singletonList(SchemaTable.newBuilder().setTable("t_user").build()));
       CDCClient cdcClient = new CDCClient(parameter);
       cdcClient.start();
   ```
   
   it got errors as follow:
   
   ```shell
   11:49:21.877 [nioEventLoopGroup-2-1] INFO 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.LoginRequestHandler 
- Server greeting result, server version: 5.3.1, protocol version: 1
   11:49:21.948 [nioEventLoopGroup-2-1] INFO 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.LoginRequestHandler 
- Login success, username root
   11:49:21.960 [nioEventLoopGroup-2-1] ERROR 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.CDCRequestHandler - 
received error response request_id: "e172b6e6-2c2a-4696-a3bd-29440fe77d0c"
   status: FAILED
   error_code: "2"
   error_message: "Illegal create subscription request parameter"
   ```
   
   ---
   
   I also tried the latest version on the master branch, 
`apache-shardingsphere-5.3.2-SNAPSHOT-shardingsphere-proxy-bin`
   
   server.yaml:
   
   ```yaml
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: governance_ds
         server-lists: localhost:2181
         retryIntervalMilliseconds: 500
         timeToLiveSeconds: 60
         maxRetries: 3
         operationTimeoutMilliseconds: 500
   
   authority:
     users:
       - user: root@%
         password: root
     privilege:
       type: ALL_PERMITTED
   
   props:
     cdc-server-port: 33071 # CDC server port
   ```
   
   sharding conf:
   
   ```yaml
   databaseName: sharding_db
   
   dataSources:
    ds_0:
      url: jdbc:mysql://127.0.0.1:3306/sparktest?serverTimezone=UTC&useSSL=false
      username: root
      password: lx123456
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
      minPoolSize: 1
   ```
   
   Once restarted directly, we got:
   
   ```
   Exception in thread "main" Can't construct a java object for !CDC; 
exception=Invalid tag: !CDC
    in 'string', line 7, column 3:
       - !CDC
         ^
   
           at 
org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:364)
           at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270)
           at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253)
   ```
   
   Re-run after deleting zk's `governance_ds` node, .ShardingSphereProxy runs 
successfully.
   
   
   ```shell
   [INFO ] 2023-03-28 11:54:41.028 [main] o.a.s.d.p.c.e.PipelineJobWorker - 
start worker initialization
   [INFO ] 2023-03-28 11:54:41.033 [main] o.a.s.d.p.c.e.PipelineJobWorker - 
worker initialization done
   [INFO ] 2023-03-28 11:54:41.075 [main] o.a.s.p.v.ShardingSphereProxyVersion 
- Database name is `MySQL`, version is `8.0.26`, database name is `sharding_db`
   Thanks for using Atomikos! This installation is not registered yet.
   REGISTER FOR FREE at http://www.atomikos.com/Main/RegisterYourDownload and 
receive:
   - tips & advice
   - working demos
   - access to the full documentation
   - special exclusive bonus offers not available to others
   - everything you need to get the most out of using Atomikos!
   [INFO ] 2023-03-28 11:54:41.640 [main] o.a.s.p.frontend.ShardingSphereProxy 
- ShardingSphere-Proxy Cluster mode started successfully
   ```
   
   But when i start `Bootstrap`, i got another error:
   
   ```
   11:55:39.913 [nioEventLoopGroup-2-1] INFO 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.LoginRequestHandler 
- Server greeting result, server version: 5.3.2-SNAPSHOT, protocol version: 1
   11:55:39.958 [nioEventLoopGroup-2-1] INFO 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.LoginRequestHandler 
- Login success, username root
   11:55:39.971 [nioEventLoopGroup-2-1] ERROR 
org.apache.shardingsphere.data.pipeline.cdc.client.handler.CDCRequestHandler - 
received error response status: FAILED
   error_code: "HY000"
   error_message: "Rule `ShardingRule` should have and only have one instance."
   ```
   
   I am wondering where my configuration is wrong, thank you!
   
   
   ---
   
   My Environments:
   
   Win10
   
   shardingsphere-proxy run on windows by `start.bat`
   
   ```
   java version "17.0.6" 2023-01-17 LTS
   Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190)
   Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, 
sharing)
   ```
   
   ```
   Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
   Maven home: D:\Development\Tools\Maven\apache-maven-3.8.1\bin\..
   Java version: 17.0.6, vendor: Oracle Corporation, runtime: 
D:\Development\Tools\Java\jdk-17
   Default locale: zh_CN, platform encoding: GBK
   OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
   ```
   
   Zk deployed by Docker.
   
   
![image](https://user-images.githubusercontent.com/42756849/228122812-6561a667-9769-4db2-9de0-3dcaad27c064.png)
   
   
   **For English only**, other languages will not accept.
   
   Before asking a question, make sure you have:
   
   - Googled your question.
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to