Method dubbo framework. . .

Illustration.

 

 

 

 

 

A, dubbo Instructions.

    1 . All the service layer must use the service annotations (spring frame with the previous, now @Service annotation framework provided with dubbo)
     //     @Service (= timeout in seconds)
        
         
    2 . When configuring the port number dubbo 
        only when the project provider and consumer items necessary for direct data communication port number to follow 
        that must be noted that both provider or consumer, configured dubbo port number must be consistent with 
        the port number Feel free to customize! ! !
        

 

 

 

8081 = server.port 
server.context -path = / zxf 

spring.datasource.driver - class -name = com.mysql.jdbc.Driver 
spring.datasource.url = jdbc: MySQL: // localhost: 3306 / qy200 useSSL =? to false 
spring.datasource.username = the root 
spring.datasource.password = the root 
spring.datasource.type = com.alibaba.druid.pool.DruidDataSource 


mybatis.type -aliases- Package = com.aaa.zxf.dubbo.model 
mybatis.mapper the CLASSPATH = -locations: Mapper / * Mapper.xml 

#dubbo the application name of the configuration dubbo. Can be seen directly in dubbo project is a project to change what kind of project
# dubbo-admin producer / consumer ------ application name ---- needs based on the current project 
# Provider zookeeper need to know that a class needs to be registered in the zookeeper
# Functions provided by naming 
dubbo.application.name = user-provider 


protocol agreement protocol # Configure remote call when the project used .. --dubbo TCP and UPD 
dubbo.protocol.name = dubbo 

# configuration required to use dubbo port number 
# NOTE! ! ! consumer and provider port number configured consistent random number order. 
= 20881 dubbo.protocol.port 


#zookeeper mailing address dubbo integrated framework zookeeper 
#provider need to register service zookeeper, zookeeper let the provider know which one! 

#【note! ! ! ] Dubbo and provider of consumer and zookeeper configuration all zookeeper cluster leader and follower can be equipped 
# because in the end, whether leader or follower can be equipped with (unless the leader is down) 
# zookeeper port number is 2181 need to be consistent! ! 
= zookeeper dubbo.registry.address: //192.168.132.133: 2181

Scanning change pack #dubbo package and all subclasses are registered to the zookeeper 
dubbo.scan.base-Packages = com.aaa.zxf.dubbo.service.impl 


dubbo.scan.base- # Dubbo configured according to the application packages attribute to determine whether the project is provider or Consumer 

# open my zookeeper

 

 

 

 

 

3 . Whether in dubbo or the zookeeper configuration provider and consumer in 
        all zookeeper cluster either leader or follower can be equipped with 
        EG: 
            zookeeper01 is the leader 
                dubbo -admin-- the zookeeper's configuration was changed -> zookeeper01 
            zookeeper02 is leader 
                dubbo -admin-- the zookeeper's configuration was changed -> zookeeper01 
            because the final configuration is a leader or follower, whether the request will be forwarded to the leader (unless the leader is down) 
    //         All port numbers zookeeper configuration should be 2181 
            because dubbo the port number is 2181
            
     4 .dubbo how to determine the project as a service producer or consumer services? 
        In accordance dubbo.scan.base application.properties is configured - to the determination of the item attribute provider or packages Consumer

     . 5Both the provider or consumer, service package must be consistent 
        provider -> IUserService: com.aaa.lee.dubbo.service 
        Consumer -> IUserService: com.aaa.lee.dubbo.service 
        and also names of the two interfaces We must be consistent! ! ! ! 
    //     interface method must also be consistent (return value name, return type, method name, parameter)
         
    6 .consumer project controller need to call service when notes can no longer use @Autowired implanting service 
        because the whole consumer There is only service interface and implementation class does not 
    //     need to use @Reference dubbo provided
         
    7 .Provider and consumer of application.properties profile dubbo.application.name not be the same! ! ! ! 
        Provider: 
            dubbo.application.name = user- Provider  
        Consumer:
            dubbo.application.name = user-consumer
            
     8 . Whether provider or consumer project must take zookeeper address configuration consistent! ! ! 
        Are not required to configure Leader ---> follower will automatically forward requests to the Leader
        
     . 9 . All entity classes must implement interfaces serialized 
        because the class implements the serialization interface entity can be sent to the entity classes in a stream 
            provider User entity class will be converted to a binary stream -----> ---- to a Consumer> Consumer not received a User object, but a binary stream
         ----> Consumer must take the entire binary stream is converted to a User object before you can use! 
            In other words, whether consumer or provider must be to implement serialization Interface

 

 

 

 

 

 


       

Guess you like

Origin www.cnblogs.com/ZXF6/p/11479274.html
Recommended