1.安装elasticsearch

1.下载安装包

  1. cd /data/
  2. wget https://mirrors.bfsu.edu.cn/apache/skywalking/6.5.0/apache-skywalking-apm-6.5.0.tar.gz
  3. wget https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-6.4.0.tar.gz

2.安装解压

tar zxvf elasticsearch-6.4.0.tar.gz 
mv elasticsearch-6.4.0 elasticsearch

3.修改elasticsearch配置

vim elasticsearch/config/elasticsearch.yml
cluster.name: dbaasCluster
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
network.host: 0.0.0.0
http.port: 9200

4.创建用户组,创建启动用户

groupadd es
useradd -g es es -p 123
chown -R es:es /data/elasticsearch

5.修改limit数量,调大当前用户的软硬限制,需要重新登陆系统生效

vim /etc/security/limits.conf  #添加以下内容
es soft nofile 75535
es hard nofile 75535
es soft nofile 65535
es hard nofile 65537

6.修改内核参数vm.max_map_count

vim /etc/sysctl.conf  #添加以下内容
vm.max_map_count=262144

7.切换到es用户,启动elastic’search

su - es
/data/elasticsearch/bin/elasticsearch -d

8.浏览器访问ip:9200/进行验证
image.png

2.安装skywalking

下载解压

cd /data/
wget https://mirrors.bfsu.edu.cn/apache/skywalking/6.5.0/apache-skywalking-apm-6.5.0.tar.gz
tar zxvf apache-skywalking-apm-6.4.0.tar.gz

修改配置文件

vim apache-skywalking-apm-bin/config/application.yml
storage:
   elasticsearch:
     nameSpace: ${SW_NAMESPACE:"dbaasCluster"}
     clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:127.0.0.1:9200}
     protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
     trustStorePath: ${SW_SW_STORAGE_ES_SSL_JKS_PATH:"../es_keystore.jks"}
     trustStorePass: ${SW_SW_STORAGE_ES_SSL_JKS_PASS:""}
     user: ${SW_ES_USER:""}
     password: ${SW_ES_PASSWORD:""}
     indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
     indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
     # Those data TTL settings will override the same settings in core module.
     recordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day
     otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:45} # Unit is day
     monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:18} # Unit is month
     # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
     bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:1000} # Execute the bulk every 1000 requests
     flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
     concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
     resultWindowMaxSize: ${SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE:10000}
     metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
     segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}

启动skywalking

cd apache-skywalking-apm-bin/bin/
./startup.sh

修改apache-skywalking-apm-bin/webapp/webapp.yml 的端口号

server:
  port: 8999

collector:
  path: /graphql
  ribbon:
    ReadTimeout: 10000
    # Point to all backend's restHost:restPort, split by ,
    listOfServers: 127.0.0.1:12800

浏览器访问http://ip:8080/

3.配置java-agent

可以这样修改你的jar包启动脚本

java -javaagent:xxxx/agent/skywalking-agent.jar -Dskywalking.agent.service_name=xxx -jar xxx.jar