ELK Lesson 19:Elastic APM基本設定
Elastic APM基本設定
步驟1:建立APM-Server的keystore,並新增Elasticsearch的認證參數。
$ su - apm-server
-bash-4.2$ apm-server keystore create
-bash-4.2$ apm-server keystore add ES_ID
-bash-4.2$ apm-server keystore add ES_PWD
在此,我們特意使用apm-server這個帳號來建立keystore,因為APM-Server必須是apm-server這個帳號來運行,如果不這樣做,apm-server會無法正常讀取keystore。
步驟2:修改apm-server設定。
$ sudo vi /etc/apm-server/apm-server.yml
各項設定如下:
apm-server:
# Defines the host and port the server is listening on. Use "unix:/path/to.sock" to listen on a unix domain socket.
host: "192.168.50.103:8200"
output.elasticsearch:
# Array of hosts to connect to.
# Scheme and port can be left out and will be set to the default (`http` and `9200`).
# In case you specify and additional path, the scheme is required: `http://localhost:9200/path`.
# IPv6 addresses should always be defined as: `https://[2001:db8::1]:9200`.
hosts: ["lab-elk-3.example.com:9200"]
# Boolean flag to enable or disable the output module.
enabled: true
# Set gzip compression level.
#compression_level: 0
# Protocol - either `http` (default) or `https`.
protocol: "https"
# Authentication credentials - either API key or username/password.
#api_key: "id:api_key"
username: "${ES_ID}"
password: "${ES_PWD}"
ssl.certificate_authorities: ["/etc/apm-server/certs/ca.crt"]
步驟3:啟動APM-Server。
$ sudo systemctl start apm-server
$ sudo systemctl enable apm-server
~ END ~