1.安裝JDK8:
因為oracle現在要同意協議才能下載,直接使用wget加鏈接下載不到,所以要加上前面的那些代碼:
#下載JAVA環境安裝包: wget --no-check-certificate --no-cookie --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.rpm 使用rpm -ivh jdk-8u171-linux-x64.rpm進行安裝
命令執行完畢即安裝完成,使用java -version
檢查是否安裝成功
2.部署Elasticsearch
在/etc/yum.repo.d/
下新建elasticsearch.repo
文件,內容如下:
[elasticsearch-5.x] name=Elasticsearch repository for 5.x packages baseurl=https://artifacts.elastic.co/packages/5.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
按 :wq
保存后執行sudo yum install elasticsearch -y
安裝
用vim配置文件/etc/elasticsearch/elasticsearch.yml
- 設置
cluster.name: CollectorDBCluster
。此名稱需要和collector配置文件一致。 - 設置
node.name: masterNode
, 節點名稱可以設置為任意名字,如為集群模式,則每個節點名稱需要不同。
增加如下配置
# ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticsearch comes with reasonable defaults for most settings. # Before you set out to tweak and tune the configuration, make sure you # understand what are you trying to accomplish and the consequences. # # The primary way of configuring a node is via this file. This template lists # the most important settings you may want to configure for a production cluster. # # Please consult the documentation for further information on configuration options: # https://www.elastic.co/guide/en/elasticsearch/reference/index.html # # ---------------------------------- Cluster ----------------------------------- # cluster.name: CollectorDBCluster network.host: 0.0.0.0 thread_pool.bulk.queue_size: 1000 # # Use a descriptive name for your cluster: # #cluster.name: my-application # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: master # # Add custom attributes to the node: # #node.attr.rack: r1 # # ----------------------------------- Paths ------------------------------------ # # Path to directory where to store the data (separate multiple locations by comma): # #path.data: /path/to/data # # Path to log files: # #path.logs: /path/to/logs # # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 # # Set a custom port for HTTP: # http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when new node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.zen.ping.unicast.hosts: ["host1", "host2"] # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # #discovery.zen.minimum_master_nodes: 3 # # For more information, consult the zen discovery module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructve_requires_name: true
啟動服務systemctl start elasticsearch.service
設為開機啟動systemctl enable elasticsearch.service
如果es 運行不成功報內存不夠可以設置內存:
sudo sysctl -w vm.max_map_count=262144
檢查下ES是否正常運行: curl localhost:9200
3.部署collector
下載release的版本https://github.com/OpenSkywalking/skywalking-netcore/releases
#下載collector wget https://github.com/OpenSkywalking/skywalking-netcore/releases/download/v0.1.0/apache-skywalking-for-netcore-0.1.tar.gz #解壓 tar -xzvf apache-skywalking-for-netcore-0.1.tar.gz
修改 /data/aimei/skywalking/collector/apache-skywalking-for-netcore-0.1/bin/webappService.sh
中的127.0.0.1
為Server-01
的IP地址,目前為10.0.1.250。
最終腳本如下:
PRG="$0" PRGDIR=`dirname "$PRG"` [ -z "$WEBAPP_HOME" ] && WEBAPP_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` WEBAPP_LOG_DIR="${WEBAPP_HOME}/logs" JAVA_OPTS=" -Xms256M -Xmx512M" JAR_PATH="${WEBAPP_HOME}/webapp" if [ ! -d "${WEBAPP_HOME}/logs" ]; then mkdir -p "${WEBAPP_LOG_DIR}" fi _RUNJAVA=${JAVA_HOME}/bin/java [ -z "$JAVA_HOME" ] && _RUNJAVA=java eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} -jar ${JAR_PATH}/skywalking-webapp.jar \ --server.port=8080 --collector.ribbon.listOfServers=10.0.1.250:10800 \ 2>${WEBAPP_LOG_DIR}/webapp.log 1> /dev/null &" if [ $? -eq 0 ]; then sleep 1 echo "Skywalking Web Application started successfully!" else echo "Skywalking Web Application started failure!" exit 1 fi
修改/data/aimei/skywalking/collector/apache-skywalking-for-netcore-0.1/config/application.yml
中的所有localhost
為Server-01
的IP地址,目前為10.0.1.250。
給腳本權限及運行
chmod 777 /data/aimei/skywalking/collector/apache-skywalking-for-netcore-0.1/bin/*.sh #運行 啟動WebUI和Collector /data/aimei/skywalking/collector/apache-skywalking-for-netcore-0.1//bin/startup.sh
4.查看監測
打開http://10.0.1.250:8080
,查看監測情況
如果防火牆沒有開請開啟防火牆:
netstat -tnlp | grep 22 ---查看這個端口什么在 使用 vi /etc/sysconfig/iptables 編輯防火牆 systemctl restart iptables.service ----重啟防火牆
docker-compose 部署教程: