Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /www/wwwroot/www.bdysoft.com/usr/themes/Joe/public/tencent_protect.php on line 36

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/www.bdysoft.com/usr/themes/Joe/public/tencent_protect.php on line 36
YUM安装RabbitMQ、ES、Kibana、Harbor - 凝梦

YUM安装RabbitMQ、ES、Kibana、Harbor

张柯
2022-02-11 发布 / 正在检测是否收录...

1.安装RabbitMQ

# 1、配置epel
yum install epel-release

# 2、安装rabbitmq server
yum install rabbitmq-server

# 3、启动rabbitmq
systemctl start rabbitmq-server

# 4、查看rabbitmq 状态
systemctl status rabbitmq-server

# 5、停止rabbitmq
systemctl stop rabbitmq-server

# 6、设置rabbitmq开机自启动
systemctl enable rabbitmq-server

# 7、配置网页插件(从网页登陆端口号:15672)
rabbitmq-plugins enable rabbitmq_management

# 8、配置访问root权限账户密码
rabbitmqctl add_user admin admin  //添加用户,后面两个参数分别是用户名和密码
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"  //添加权限
rabbitmqctl set_user_tags admin administrator  //修改用户角色,将用户设为管理员

2.安装ES及Kibana

2.1 安装elasticsearch

# 1.下载并安装公共签名密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

# 2.创建 yum 源文件
vim /etc/yum.repos.d/elasticsearch.repo
# 添加以下内容:
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

# 3.正式安装elasticsearch
yum install -y elasticsearch

# 4.启动elasticsearch
systemctl start elasticsearch.service

# 5.查看elasticsearch状态
systemctl status elasticsearch.service

# 6.停止elasticsearch
systemctl stop elasticsearch.service

# 7.开机自启elasticsearch
systemctl enable elasticsearch.service

# 8.修改elasticsearch占用的内存【可选】
# 备注:安装时默认为服务器总内存的1/2,测试环境下可以按照实际需求改小。
vim /etc/elasticsearch/jvm.options
修改为:
-Xms512m
-Xmx512m

# 9.开启elasticsearch密码访问【可选】
# 备注:如果是生产环境下,一般访问es是通过内网ip访问,这样既保证安全,又保证速率,但是我们在开发、测试环境下可以通过加密码的方式进行远程连接访问。
vim /etc/elasticsearch/elasticsearch.yml
# 在末尾添加以下内容
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
# 重启es后执行设置用户名和密码的命令,这里需要为以下用户分别设置密码,elastic, apm_system, kibana_system, logstash_system,beats_system,remote_monitoring_user
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
# 重启es后生效密码生效。
# 后期需要修改密码的话可以执行:
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "新密码" }'

# 如果要开启外部访问,需要在yml配置文件中修改
discovery.seed_hosts: ["[::1]", "0.0.0.0"]
network.host: 0.0.0.0

2.2 安装kibana

# 1.下载并安装公共签名密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

# 2.添加源
vim /etc/yum.repos.d/kibana.repo
# 添加以下内容:
[kibana-7.x]
name=Kibana repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

# 3.正式安装kibana
yum install -y kibana

# 4.配置kibana
vim /etc/kibana/kibana.yml
# 修改一下内容:
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
i18n.locale: "zh-CN"
# 如果是前面设置了访问密码还需要加入以下内容
elasticsearch.username: "kibana"
elasticsearch.password: "znghx123"

# 5.刷新服务配置
systemctl daemon-reload

# 6.启动kibana
systemctl start kibana.service

# 7.查看状态kibana
systemctl status kibana.service

# 8.关闭kibana
systemctl stop kibana.service

# 9.开机自启kibana
systemctl enable kibana.service

3.搭建Sentinel环境

# 1.从github下载sentinel部署文件
wget https://github.com/alibaba/Sentinel/releases/download/v1.8.0/sentinel-dashboard-1.8.0.jar

# 2.启动Sentinel 控制台,执行下面的命令
java -Dserver.port=8180 -Dcsp.sentinel.dashboard.server=39.103.163.89:8180 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.0.jar

4.安装SkyWalking

# 1.下载(下载慢的话,可以先下载到本地,然后上传到服务器中)
wget https://mirrors.bfsu.edu.cn/apache/skywalking/8.5.0/apache-skywalking-apm-8.5.0.tar.gz

# 2.解压缩文件
tar -zxvf apache-skywalking-apm-8.5.0.tar.gz

# 3.修改启动端口,不修改的话默认为8080
vim webapp/webapp.yml 
# 修改成以下内容
server:
  port: 8480

# 4.启动skywalking
bin/startup.sh

5.安装seata

# 1.下载(下载慢的话,可以先下载到本地,然后上传到服务器中)
wget https://github.com/seata/seata/releases/download/v1.4.2/seata-server-1.4.2.tar.gz

# 2.解压缩文件
tar -zxvf seata-server-1.4.2.tar.gz

# 3.创建数据库并运行一下sql指令
备注:不同版本可能有所差异,具体可以在github上查看
例如:https://github.com/seata/seata/blob/1.4.2/script/server/db/mysql.sql

-- the table to store GlobalSession data
CREATE TABLE IF NOT EXISTS `global_table`
(
    `xid`                       VARCHAR(128) NOT NULL,
    `transaction_id`            BIGINT,
    `status`                    TINYINT      NOT NULL,
    `application_id`            VARCHAR(32),
    `transaction_service_group` VARCHAR(32),
    `transaction_name`          VARCHAR(128),
    `timeout`                   INT,
    `begin_time`                BIGINT,
    `application_data`          VARCHAR(2000),
    `gmt_create`                DATETIME,
    `gmt_modified`              DATETIME,
    PRIMARY KEY (`xid`),
    KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
    `branch_id`         BIGINT       NOT NULL,
    `xid`               VARCHAR(128) NOT NULL,
    `transaction_id`    BIGINT,
    `resource_group_id` VARCHAR(32),
    `resource_id`       VARCHAR(256),
    `branch_type`       VARCHAR(8),
    `status`            TINYINT,
    `client_id`         VARCHAR(64),
    `application_data`  VARCHAR(2000),
    `gmt_create`        DATETIME(6),
    `gmt_modified`      DATETIME(6),
    PRIMARY KEY (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(128),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_branch_id` (`branch_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;


# 4.修改conf/file.conf 配置文件,主要修改数据库信息,如下:
vim conf/file.conf
# 修改内容如下
mode = "db"
url = "jdbc:mysql://127.0.0.1:3306/seata?rewriteBatchedStatements=true"
user = "seata"
password = "zEGrST4EFmHnShSE"

# 5.将lib/jdbc/mysql-connector-java-8.0.19.jar 复制到lib
mv jdbc/mysql-connector-java-8.0.19.jar ../lib

# 6.修改conf/registry.conf 
vim conf/registry.conf
#修改内容如下
type = "nacos"

# 7.启动Seata服务
sh seata-server.sh 

6.安装Harbor仓库

# 1.安装docker-compose
curl -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose

# 2.对二进制文件赋可执行权限
chmod +x /usr/local/bin/docker-compose

# 3.docker-compose是否安装成功
docker-compose --version

# 4.下载Harbor安装文件
 wget https://github.com/vmware/harbor/releases/download/v1.1.2/harbor-online-installer-v1.1.2.tgz
 
# 5.解压后配置harbor
vim harbor.cfg 
# 修改以下内容:
# hostname设置访问地址,可以使用ip、域名,不可以设置为127.0.0.1或localhost
hostname = harbor.znghx.com
# mysql数据库root用户默认密码7a1f162197bfb2d2,实际使用时修改下
db_password = 7a1f162197bfb2d2

# 6.修改docker, 在ExeStart 后面加上 --insercure-registry  后面的10.0.10.42即为harbor的地址
vi /lib/systemd/system/docker.service
# 修改内容
# 修改配置文件,ExecStart之后添加
-H tcp://0.0.0.0:2375
 --insecure-registry=http://harbor.znghx.com

# 7.在idea->docker 配置docker地址:tcp://39.103.163.89:2375
© 版权声明
THE END
喜欢就支持一下吧
点赞 0 分享 收藏

评论 (1)

取消
  1. 头像
    树冢
    Windows 10 · Google Chrome

    如果需要es可以外部访问,需要配置一下:
    network.host: 0.0.0.0
    discovery.seed_hosts: ["[::1]", "0.0.0.0"]

    回复