sw部署
hostnamectl set-hostname node-1
tar -zxvf elasticsearch-7.17.0-linux-x86_64.tar.gz -C /opt
在文件最后添加如下几行内容
[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@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
- 点赞
- 收藏
- 关注作者
评论(0)