弄得很乱,但是弄完了,阿里云centos7.3+springboot+dubbo+zookeeper

时间:2021-10-11 22:47:01

宗旨网

https://mp.weixin.qq.com/s?__biz=Mzg2OTA0Njk0OA==&mid=2247484809&idx=1&sn=a789eba40404e6501d51b24345b28906&source=41#wechat_redirect

 

wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz

wget https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5.tar.gz

tar包压缩的时候用cvf参数,解压的时候用xvf参数

/usr/local/tools/zk/zookeeper/data


wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

tar xzf jdk-8u141-linux-x64.tar.gz
---------------------
作者:王彦清
来源:CSDN
原文:https://blog.csdn.net/u011365831/article/details/79301188
版权声明:本文为博主原创文章,转载请附上博文链接!


发现自己没装jdk
/usr/local/tools/jdk/jdk1.8.0_141


JAVA_HOME=/usr/local/tools/jdk/jdk1.8.0_141 根据自己的实际路径改 ​CLASSPATH=.:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH ​export JAVA_HOME CLASSPATH PATH

 

./zkServer.sh start

./zkServer.sh status

standalone 独立 启动了


弄东西的时候,o 要弄dubbo
dubbo要弄tomcat

https://www.cnblogs.com/kingsonfu/p/9802537.html tomcat

cd /usr/local/tomcat/conf

vi tomcat-users.xml (末尾添加如下信息) 

tar -xzvf apache-tomcat-7.0.86.tar.gz
<user username="admin" password="admin" roles="manager-gui"/>

<user username="admin" password="s3cret" roles="manager-gui"/>

密码设置不符合安全规则应该是,还有tomcat启动。浏览器访问巨慢
阿里云服务器tomcat访问超级慢解决方案
https://blog.csdn.net/u013361107/article/details/80826092
https://blog.csdn.net/wtl1992/article/details/79511434
解决办法:

  tomcat bin/ catalina.sh 中加入JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"
JAVA_OPTS="$JAVA_OPTS -Djava.security.egd=file:/dev/./urandom"


You are not authorized to view this page. By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file.

https://blog.csdn.net/cai_eternal/article/details/76069314
/webapps/manager/META_INF/context.xml文件

<Context antiResourceLocking="false" privileged="true" >
<!--注释这里,去除对访问权限的设置
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->


然后找dubbo网站
https://blog.csdn.net/qq_28988969/article/details/79866111

下载dubbo2.6
zip文件
阿里centos7 无zip解压
先https://bbs.aliyun.com/simple/t137179.html
yum install unzip

然后解压unzip dubbo

mvn package -Dmaven.skip.test=true 发现需要maven
https://blog.csdn.net/vleess/article/details/84443316

https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

maven
/usr/local/tools/maven/apache-maven-3.6.1

#maven
M2_HOME=/usr/local/tools/maven/apache-maven-3.6.1

vi /etc/profile
我改的是 ~/.bash_profile
source

<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>

mvn -v
maven 默认本地库地址cd ~/.m2
${user.home}/.m2/repository
https://www.cnblogs.com/jtestroad/p/8393257.html

ssh root@119.23.53.53

mvn package -Dmaven.skip.test=true
查看打包好的war
/usr/local/tools/dubbo/dubbo-dubbo-2.6.0/dubbo-admin/target

复制dubbo-admin-2.6.0.war,到tomcat的webapps目录下
/usr/local/tools/tomcat/apache-tomcat-9.0.21/webapps

然后启动,关闭tomcat


cd /usr/local/tools/tomcat/apache-tomcat-9.0.21/webapps/dubbo-admin-2.6.0/WEB-INF

修改dubbo.properties
# 和zookeeper注册中心<dubbo:registry address="zookeeper://127.0.0.1:2181" />中的保持一致
dubbo.registry.address=zookeeper://127.0.0.1:2181
# 用户名
dubbo.admin.root.password=root
# 密码
dubbo.admin.guest.password=guest
---------------------
作者:大白能
来源:CSDN
原文:https://blog.csdn.net/qq_28988969/article/details/79866111
版权声明:本文为博主原创文章,转载请附上博文链接!


改项目名
mv dubbo-admin-2.6.0 dubbo2.6

启动tomcat
访问
http://119.23.53.53:8080/dubbo2.6/

用户名密码是 root root 真奇怪


查看网络状态netstat -lntup

参考这个https://blog.csdn.net/wangyuxi__/article/details/89856740

provider
# 配置端口
server.port=8012
#dubbo服务名
spring.dubbo.application.name=dubbo-provider
#注册中心
spring.dubbo.application.registry=zookeeper://119.23.53.53:2181

#dubbo的Rpc协议
spring.dubbo.protocol.name=dubbo

#dubbo的rpc端口
spring.dubbo.protocol.port=20880

#远程服务超时时间
spring.dubbo.protocol.timeout=5000

#发布服务的扫描路径
spring.dubbo.base-package=top.snailclimb.service.impl

 

consumer
# 配置端口
server.port=8334
#dubbo服务名
spring.dubbo.application.name=dubbo-consumer
#注册中心
spring.dubbo.application.registry=zookeeper://119.23.53.53:2181

#dubbo的Rpc协议
spring.dubbo.protocol.name=dubbo
#dubbo的rpc端口
spring.dubbo.protocol.port=20880
#远程服务超时时间
spring.dubbo.protocol.timeout=5000

#发布服务的扫描路径
spring.dubbo.base-package=top.snailclimb.dubboconsumer.controller

启动服务

http://119.23.53.53:8080/dubbo2.6/governance/consumers

http://localhost:8334/hello

success

然后,可以尝试把consumer,provider打包,部署到服务器上跑跑

 反正乱的很,搞完了