dubbo first use experience

The first point: to install in linux registry zookeeper get ip
installation steps: to be perfect

Step Two: To dubbo the war to start Tomcat package put under wabapps linux tomcat, if the dubbo and zookeeper not on the same server, war package in dubbo found in the config configuration file to modify the configuration file ip address

The third step: that the war dubbo disposed inside a war pom profile dubbo a package configuration is formed this way is distributed soa
code under e3mall-maneger-web pom package

	<dependency>
		<groupId>com.alibaba</groupId>
		<artifactId>dubbo</artifactId>
		<exclusions>
			<exclusion>
				<groupId>org.springframework</groupId>
				<artifactId>spring</artifactId>
			</exclusion>
			<exclusion>
				<groupId>org.jboss.netty</groupId>
				<artifactId>netty</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
	<dependency>
		<groupId>org.apache.zookeeper</groupId>
		<artifactId>zookeeper</artifactId>
	</dependency>
	<dependency>
		<groupId>com.github.sgroschupf</groupId>
		<artifactId>zkclient</artifactId>
	</dependency>

Code under e3mall-maneger-web springmvc.xml of

<dubbo:application name="e3-manager-web"/>
<dubbo:registry protocol="zookeeper" address="192.168.154.130:2181"/>	
<dubbo:reference interface="cn.e3mall.service.ItemService" id="itemService" />

Configuration in e3mall-maneger-service pom package

	<dependency>
		<groupId>com.alibaba</groupId>
		<artifactId>dubbo</artifactId>
		<exclusions>
			<exclusion>
				<groupId>org.springframework</groupId>
				<artifactId>spring</artifactId>
			</exclusion>
			<exclusion>
				<groupId>org.jboss.netty</groupId>
				<artifactId>netty</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
	<dependency>
		<groupId>org.apache.zookeeper</groupId>
		<artifactId>zookeeper</artifactId>
	</dependency>
	<dependency>
		<groupId>com.github.sgroschupf</groupId>
		<artifactId>zkclient</artifactId>
	</dependency>

In e3mall-maneger-service applicationContext-service.xml code

<!-- 提供方应用信息,用于计算依赖关系 -->
<dubbo:application name="e3-manager" />
<dubbo:registry protocol="zookeeper" address="192.168.154.130:2181" />
<!-- 用dubbo协议在20880端口暴露服务 -->
<dubbo:protocol name="dubbo" port="20880" />
<!-- 声明需要暴露的服务接口 -->
<dubbo:service interface="cn.e3mall.service.ItemService" ref="itemServiceImpl" timeout="600000"/>

Guess you like

Origin blog.csdn.net/qq_42412743/article/details/93761151