sw部署

举报
yd_246355293 发表于 2022/12/17 11:57:38 2022/12/17
【摘要】 hostnamectl set-hostname node-1tar -zxvf elasticsearch-7.17.0-linux-x86_64.tar.gz -C /optcd /opt/elasticsearch-7.17.0/mkdir data在文件最后添加如下几行内容 [root@node-1 elasticsearch-7.17.0]# vi config/elasticse...

hostnamectl set-hostname node-1

tar -zxvf elasticsearch-7.17.0-linux-x86_64.tar.gz -C /opt

cd /opt/elasticsearch-7.17.0/

mkdir data

在文件最后添加如下几行内容

 [root@node-1 elasticsearch-7.17.0]# vi config/elasticsearch.yml
 …
 cluster.name: my-application
 node.name: node-1
 path.data: /opt/elasticsearch-7.17.0/data
 path.logs: /opt/elasticsearch-7.17.0/logs
 network.host: 0.0.0.0
 cluster.initial_master_nodes: ["node-1"]
 http.cors.enabled: true
 http.cors.allow-origin: "*"
 http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

创建Elasticsearch启动用户,并设置属组及权限:

[root@node-1 elasticsearch-7.17.0]# groupadd elsearch
[root@node-1 elasticsearch-7.17.0]# useradd elsearch -g elsearch -p elasticsearch
[root@node-1 elasticsearch-7.17.0]# chown -R elsearch:elsearch /opt/elasticsearch-7.17.0

修改资源限制及内核配置

[root@node-1 elasticsearch-7.17.0]# vi /etc/security/limits.conf

* hard    nofile           65536
* soft    nofile           65536
[root@node-1 elasticsearch-7.17.0]# vi /etc/sysctl.conf
vm.max_map_count=262144
[root@node-1 elasticsearch-7.17.0]# sysctl -p

ulimit -n 65536

[root@node-1 ~]# cd /opt/elasticsearch-7.17.0/
[root@node-1 elasticsearch-7.17.0]# su elsearch
[elsearch@node-1 elasticsearch-7.17.0]$ ./bin/elasticsearch -d

部署SkyWalking OAP服务

 tar -zxvf jdk-8u144-linux-x64.tar.gz -C /usr/local/

[root@node-1 ~]# vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_144
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

[root@node-1 ~]# source /etc/profile
[root@node-1 ~]# java -version

[root@node-1 ~]# tar -zxvf apache-skywalking-apm-es7-8.0.0.tar.gz -C /opt

[root@node-1 ~]# cd /opt/apache-skywalking-apm-bin-es7/
[root@node-1 apache-skywalking-apm-bin-es7]# vi config/application.yml

#集群配置使用单机版
cluster:
  selector: ${SW_CLUSTER:standalone}
  standalone:

#数据库使用elasticsearch7
storage:
  selector: ${SW_STORAGE:elasticsearch7}

  elasticsearch7:
    nameSpace: ${SW_NAMESPACE:""}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:10.24.194.203:9200}

[root@node-1 apache-skywalking-apm-bin-es7]# ./bin/oapService.sh 
SkyWalking OAP started successfully!

[root@node-1 apache-skywalking-apm-bin-es7]# vi webapp/webapp.yml

server:
  port: 8888

[root@node-1 apache-skywalking-apm-bin-es7]# ./bin/webappService.sh 
SkyWalking Web Application started successfully!

搭建并启动应用商城服务

[root@localhost ~]# hostnamectl set-hostname mall

[root@mall ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

XXXXXXXXX mall

[root@mall ~]# tar -zxvf gpmall.tar.gz
[root@mall ~]# mv /etc/yum.repos.d/* /media/
[root@mall ~]# cd gpmall/
[root@mall gpmall]# tar -zxvf gpmall-repo.tar.gz -C  /root/
[root@mall ~]# vi /etc/yum.repos.d/local.repo 
[mall]
name=mall
baseurl=file:///root/gpmall-repo
gpgcheck=0
enabled=1

[root@mall ~]# yum install  -y java-1.8.0-openjdk java-1.8.0-openjdk-devel  

[root@mall ~]# yum install  redis -y  

[root@mall ~]# yum  install nginx -y  

[root@mall ~]# yum  install mariadb mariadb-server -y  

[root@mall gpmall]# tar -zxvf zookeeper-3.4.14.tar.gz -C /root/

[root@mall gpmall]# cd /root/zookeeper-3.4.14/conf/
[root@mall conf]# mv zoo_sample.cfg zoo.cfg

[root@mall conf]# cd ../bin
[root@mall bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

[root@mall bin]# tar -zxvf /root/gpmall/kafka_2.11-1.1.1.tgz -C /root

[root@mall bin]# cd /root/kafka_2.11-1.1.1/bin/
[root@mall bin]# ./kafka-server-start.sh -daemon ../config/server.properties

[root@mall bin]# cd
[root@mall ~]# vi /etc/my.cnf
[mysqld]

init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

[root@mall ~]# mysqladmin -uroot password 123456
[root@mall ~]# mysql -uroot -p123456

MariaDB [(none)]> grant all privileges on *.* to root@localhost identified by '123456' with grant option;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> grant all privileges on *.* to root@"%" identified by '123456' with grant option;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> create database gpmall;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> use gpmall;
MariaDB [gpmall]> source /root/gpmall/gpmall.sql

[root@mall ~]# vi /etc/redis.conf

#bind 127.0.0.1
protected-mode no

[root@mall ~]# systemctl start redis
[root@mall ~]# systemctl enable redis
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.

[root@mall ~]# systemctl start nginx
[root@mall ~]# systemctl enable nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

[root@mall ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.24.193.168 kafka.mall
10.24.193.168 mysql.mall
10.24.193.168 redis.mall
10.24.193.168 zookeeper.mall

[root@mall ~]# rm -rf /usr/share/nginx/html/*
[root@mall ~]# cp -rvf gpmall/dist/* /usr/share/nginx/html/

[root@mall ~]# vi /etc/nginx/nginx.conf

    server {
        listen       80;
        listen       [::]:80;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
         
        location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        }
        location /user {
            proxy_pass http://127.0.0.1:8082;
        }

        location /shopping {
            proxy_pass http://127.0.0.1:8081;
        }

        location /cashier {
            proxy_pass http://127.0.0.1:8083;
        }

        error_page 404 /404.html;

[root@mall ~]# systemctl restart nginx

部署后端

[root@mall ~]# scp -r 10.24.194.203:/opt/apache-skywalking-apm-bin-es7/agent /root

[root@mall ~]# vi agent/config/agent.config

agent.service_name=${SW_AGENT_NAME:my-application}
agent.sample_n_per_3_secs=${SW_AGENT_SAMPLE:1}

collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:10.24.194.203:11800}

[root@mall ~]# nohup java -javaagent:/root/agent/skywalking-agent.jar  -jar gpmall/shopping-provider-0.0.1-SNAPSHOT.jar &
[1] 20086
[root@mall ~]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall ~]# nohup java -javaagent:/root/agent/skywalking-agent.jar  -jar gpmall/user-provider-0.0.1-SNAPSHOT.jar &
[2] 20132
[root@mall ~]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall ~]# nohup java -javaagent:/root/agent/skywalking-agent.jar  -jar gpmall/gpmall-shopping-0.0.1-SNAPSHOT.jar &
[3] 20177
[root@mall ~]# nohup: ignoring input and appending output to ‘nohup.out’

[root@mall ~]# nohup java -javaagent:/root/agent/skywalking-agent.jar  -jar gpmall/gpmall-user-0.0.1-SNAPSHOT.jar &
[4] 20281
[root@mall ~]# nohup: ignoring input and appending output to ‘nohup.out’
# httpd访问网络配置
[root@mall ~]# setsebool -P httpd_can_network_connect 1

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。