docker

docker,第1张

docker
获取centos镜像
docker pull centos
创建容器
docker run  -itd --privileged -p 20010:22 --name="centos"  centos   /usr/sbin/init
运行容器
docker start centos/docker start c2318d020e8c
进入容器
docker exec -it --user root c2318d020e8c /bin/bash
工具安装
yum install vim
yum install wget
yum install gcc
yum install make
yum install zip
yum install openssh-server
yum install dbus
yum install lsof
yum install passwd
yum install lrzsz
yum install openssh-clients 

设置root密码
passwd root
开启ssh服务
systemctl enable sshd
systemctl start ssh
使用宿主机ip链接
ssh -p 20010 root@10.11.185.31  (20010是创建容器时映射的端口)

查看运行容器
docker ps -a
提交容器
docker commit f6f25c2be760 centos:0.0.1

docker commit  -a "ctl" -m "docker run  -itd --privileged  --name=centos  --network host centos:1.0.2   /usr/sbin/init ssh22->20010" d82faace2c71 centos:1.0.2



运行容器端口映射(nacos只能宿主机访问)
docker run  -itd --privileged -p 15672:15672 -p 20010:22 -p 3306:3306 -p 8000:8000 -p 8001:8001 -p 8002:8002 -p 8003:8003 -p 8004:8004 -p 8005:8005 -p 8006:8006 -p 8007:8007 -p 8008:8008 -p 8009:8009 -p 8010:8010 -p 8011:8011 -p 8012:8012 -p 8013:8013 -p 8014:8014 -p 8015:8015 -p 6379:6379 -p 8848:8848 -p 27017:27017 -p 8080:8080 -p 2181:2181 -p 9092:9092 -p 1883:1883 -p 5672:5672 -p 9200:9200  --name="centos"  centos:0.0.1   /usr/sbin/init

在docker中使用 --network host 来为容器配置 host 网络(nacos非宿主机也能访问)
vim /etc/ssh/sshd_config 修改22端口这样可以使用ssh且docker容器不需要端口映射就能像访问宿主机一样访问docker容器
docker run  -itd --privileged  --name=centos  --network host centos:1.0.1.1   /usr/sbin/init


docker exec -it --user root 7d08bd65d6b2 /bin/bash

mysql8 安装
yum -y install libaio
yum -y install perl
yum -y install net-tools
yum install mysql-server.x86_64 
		
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root@123@CTL';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root@123@CTL';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'  WITH GRANT OPTION;
FLUSH PRIVILEGES;


部署nacos
conf/cluster.conf
127.0.0.1:8847
配置
conf/nacos-mysql.sql导入
use nacos;
source /root/softwore/nacos/conf/nacos-mysql.sql;
配置
conf/application.properties 
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=root@123@CTL
启动服务
sh /root/softwore/nacos/bin/startup.sh -m standalone



部署seata服务
配置registry.conf
cat seata-server-1.4.2/conf/registry.conf
registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"

  nacos {
    application = "seata-server"
    serverAddr = "127.0.0.1:8848"
    group = "SEATA_GROUP"
    namespace = "67af567b-1a25-49b5-a1ff-e57c0ed22d91"
    cluster = "default"
    username = "nacos"
    password = "nacos"
  }
}

config {
  # file、nacos 、apollo、zk、consul、etcd3
  type = "nacos"
  nacos {
    serverAddr = "127.0.0.1:8848"
    namespace = "67af567b-1a25-49b5-a1ff-e57c0ed22d91"
    group = "SEATA_GROUP"
    username = "nacos"
    password = "nacos"
    #dataId = "seataServer.properties"
  }
}



部署sentinel
#启动(是否注册Sentinel自己):
#不注册Sentinel自己
#java -Dserver.port=8001 -Dcsp.sentinel.log.dir=C:logssentinel-dashboard -jar sentinel-dashboard-1.8.1.jar
#注册Sentinel自己
java -Dserver.port=8001 -Dcsp.sentinel.dashboard.server=localhost:8001 -Dproject.name=sentinel-dashboard -Dcsp.sentinel.log.dir=/root/softwore/logs/sentinel-dashboard -jar sentinel-dashboard-1.8.1.jar


安装rabbitmq(https://github.com/rabbitmq/erlang-rpm)
######################start#####################
# In /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq-rabbitmq-erlang]
name=rabbitmq-rabbitmq-erlang
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md

[rabbitmq-rabbitmq-erlang-noarch]
name=rabbitmq-rabbitmq-erlang-noarch
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/noarch
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md

[rabbitmq-rabbitmq-erlang-source]
name=rabbitmq-rabbitmq-erlang-source
baseurl=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/rpm/el/8/SRPMS
repo_gpgcheck=1
enabled=1
gpgkey=https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key
       https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
gpgcheck=1
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
pkg_gpgcheck=1
autorefresh=1
type=rpm-md
######################end#####################
yum update -y
yum install -y erlang-23.3.4
yum install socat
rpm -ivh rabbitmq-server-3.8.22-1.el7.noarch.rpm
vim /etc/profile在/etc/profile环境变量配置文件末尾加上如下配置:
export LC_ALL=en_US.UTF-8
source /etc/profile

[root@1347bd620926 software]# cat /etc/default/locale 
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF8"
LC_MonETARY="zh_CN"
LC_PAPER="zh_CN"
LC_NAME="zh_CN"
LC_ADDRESS="zh_CN"
LC_TELEPHONE="zh_CN"
LC_MEASUREMENT="zh_CN"
LC_IDENTIFICATION="zh_CN"


systemctl start rabbitmq-server 
rabbitmqctl add_user ctl 123456

rabbitmqctl list_users
Listing users ...
user    tags
ctl     []
guest   [administrator]

该命令使用户ctl具有‘/’这个virtual host中所有资源的配置、写、读权限以便管理其中的资源
rabbitmqctl  set_permissions -p / ctl '.*' '.*' '.*'

#开启http://10.11.185.31:15672/ 管理页面
rabbitmqctl set_user_tags ctl administrator
rabbitmqctl start_app

rabbitmq-plugins enable rabbitmq_management
As an administrator, start and stop the server as usual, e.g. using service:
/sbin/service rabbitmq-server start
/sbin/service rabbitmq-server status
/sbin/service rabbitmq-server stop

延迟队列插件下载地址
https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
显示rabbitmq插件的路径
rabbitmq-plugins directories
#将下载的插件拷贝至插件目录
cp rabbitmq_delayed_message_exchange-3.8.17.8f537ac.ez /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.22/plugins
chmod 777 /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.22/plugins/rabbitmq_delayed_message_exchange-3.8.17.8f537ac.ez
#使插件生效
rabbitmq-plugins enable rabbitmq_delayed_message_exchange


显示rabbitmq所有插件
rabbitmq-plugins list

#卸载rabbit
rpm -qa |grep rabbit
rpm -e rabbitmq-server-3.8.22-1.el7.noarch




https://packagecloud.io/rabbitmq/erlang?page=4
https://packagecloud.io/rabbitmq/erlang/packages/el/7/erlang-20.3.8.25-1.el7.x86_64.rpm

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5672088.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存