Rate This Document
Findability
Accuracy
Completeness
Readability

Testing Examples

ZooKeeper is used as the registration center. The provider registers its services with the registration center. The consumer obtains the address list of the service provider from the registration center.

  1. Start the ZooKeeper service.
    cd /opt/zookeeper-3.4.14/bin/
    sh zkServer.sh start

    If Starting zookeeper ... STARTED is displayed, the Zookeeper service is started successfully.

  2. Check the ZooKeeper service status.
    sh zkServer.sh status
  3. Check the Zookeeper process.
    ps -ef | grep zookeeper
  4. Check the Zookeeper listening port.
    netstat -anpt | grep 2181
    • View the Zookeeper log information.
      cat zookeeper.out
    • Stop the ZooKeeper service.
      cd /opt/zookeeper-3.4.14/bin/
      sh zkServer.sh stop
  5. Download dubbo-sample.
    1
    2
    3
    cd /home
    git config --global http.sslVerify false
    git clone https://github.com/apache/dubbo-samples.git
    
  6. Go to the /home/dubbo-samples/dubbo-samples-api directory.
    1
    cd /home/dubbo-samples/dubbo-samples-api
    
  7. Start the provider.
    1
    mvn clean package
    

    1
    mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.samples.provider.Application exec:java -Ddubbo.application.qos.port=33333 -Ddubbo.application.qos.enable=true -Ddubbo.application.qos.accept.foreign.ip=false
    

    If dubbo service started is displayed, the provider is started successfully.

  8. View the listening port:
    netstat -anpt | grep 33333
    netstat -anpt | grep 20880

    To stop the provider service, press Ctrl+C.

  9. Open a new window and go to the /home/dubbo-samples/dubbo-samples-api/ directory.
    1
    cd /home/dubbo-samples/dubbo-samples-api/
    
  10. Start the consumer.
    mvn clean package

    1
    mvn -Djava.net.preferIPv4Stack=true -Dexec.mainClass=org.apache.dubbo.samples.client.Application exec:java -Dexec.cleanupDaemonThreads=false 
    

    If hi, dubbo is displayed, the consumer is started successfully.