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 部署教程: