Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 2de7ff4

Browse files
committed
Cleanup for PA enable and removal
1 parent 6e6370b commit 2de7ff4

File tree

8 files changed

+244
-261
lines changed

8 files changed

+244
-261
lines changed

docs/install/deb.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,22 @@ sudo /bin/systemctl enable elasticsearch.service
109109

110110
You can also modify the values in `/etc/default/elasticsearch` (`JAVA_HOME`, most notably), `/etc/elasticsearch/elasticsearch.yml`, and `/etc/elasticsearch/jvm.options` (to set the heap size, most notably). To learn more, see [Elasticsearch configuration](../../elasticsearch/configuration/) and [Important Settings](../docker#important-settings) on the Docker page.
111111

112-
### Setup Performance Analyzer
113112

114-
By default, Performance Analyzer's endpoints will not be accessible from outside the host machine.
113+
### (Optional) Set up Performance Analyzer
115114

116-
To edit this behavior you'll need to modify the plugin configuration. First navigate to your `ES_HOME` which is `/usr/share/elasticsearch` for a standard installation.
115+
By default, Performance Analyzer's endpoints are not accessible from outside the host machine.
116+
117+
To edit this behavior, modify the plugin configuration. First navigate to `ES_HOME`, which is `/usr/share/elasticsearch` for a standard installation.
117118

118119
```bash
119120
cd $ES_HOME # navigate to the Elasticsearch home directory
120121
cd plugins/opendistro_performance_analyzer/pa_config/
121122
vi performance-analyzer.properties
122123
```
123124

124-
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`. An example is provided below.
125-
```bash
125+
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`:
126+
127+
```
126128
# ======================== Elasticsearch performance analyzer plugin config =========================
127129
128130
# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.
@@ -162,11 +164,13 @@ plugin-stats-metadata = plugin-stats-metadata
162164
agent-stats-metadata = agent-stats-metadata
163165
```
164166

165-
Finally, restart the Elasticsearch service and PerformanceAnalyzer will be accessible from outside the machine.
167+
Finally, restart the Elasticsearch service. After the restart, Performance Analyzer is accessible from outside the machine:
168+
166169
```bash
167170
sudo systemctl restart elasticsearch.service
168171
```
169172

173+
170174
## Where are the files?
171175

172176
The Debian package installs files to the following locations:

docs/install/docker.md

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -187,49 +187,23 @@ services:
187187
You can use this same method to [pass your own certificates](../docker-security/) for use with the [Security](../../security/configuration/) plugin.
188188

189189

190-
## Bash access to containers
191-
192-
To create an interactive Bash session in a container, run `docker ps` to find the container ID. Then run:
193-
194-
```bash
195-
docker exec -it <container-id> /bin/bash
196-
```
197-
190+
### (Optional) Set up Performance Analyzer
198191

199-
## Important settings
192+
By default, Performance Analyzer's endpoints are not accessible from outside the Docker container.
200193

201-
For production workloads, make sure the [Linux setting](https://www.kernel.org/doc/Documentation/sysctl/vm.txt) `vm.max_map_count` is set to at least 262144. On the Open Distro for Elasticsearch Docker image, this setting is the default. To verify, start a Bash session in the container and run:
194+
To edit this behavior, open a shell session in the container and modify the configuration:
202195

203196
```bash
204-
cat /proc/sys/vm/max_map_count
205-
```
206-
207-
To increase this value, you have to modify the Docker image. On the RPM install, you can add this setting to the host machine's `/etc/sysctl.conf` file by adding the following line:
208-
209-
```
210-
vm.max_map_count=262144
211-
```
212-
213-
Then run `sudo sysctl -p` to reload.
214-
215-
The `docker-compose.yml` file above also contains several key settings: `bootstrap.memory_lock=true`, `ES_JAVA_OPTS=-Xms512m -Xmx512m`, `nofile 65536` and `port 9600`. Respectively, these settings disable memory swapping (along with `memlock`), set the size of the Java heap (we recommend half of system RAM), set a limit of 65536 open files for the Elasticsearch user, and allow you to access Performance Analyzer on port 9600.
216-
217-
### Setup Performance Analyzer
218-
219-
By default, Performance Analyzer's endpoints will not be accessible from outside the Docker container.
220-
221-
To edit this behavior you'll need to open up a shell session in the container and modify the configuration.
222-
223-
```bash
224-
docker ps # Lookup the container id
197+
docker ps # Look up the container id
225198
docker exec -it <container-id> /bin/bash
226199
# Inside container
227200
cd plugins/opendistro_performance_analyzer/pa_config/
228201
vi performance-analyzer.properties
229202
```
230203

231-
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`. An example is provided below.
232-
```bash
204+
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`:
205+
206+
```
233207
# ======================== Elasticsearch performance analyzer plugin config =========================
234208

235209
# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.
@@ -269,10 +243,41 @@ plugin-stats-metadata = plugin-stats-metadata
269243
agent-stats-metadata = agent-stats-metadata
270244
```
271245
272-
Finally, restart the Performance Analyzer agent and it will become accessible.
246+
Then restart the Performance Analyzer agent:
247+
273248
```bash
274249
kill $(ps aux | grep -i 'PerformanceAnalyzerApp' | grep -v grep | awk '{print $2}')
275250
```
251+
252+
253+
## Bash access to containers
254+
255+
To create an interactive Bash session in a container, run `docker ps` to find the container ID. Then run:
256+
257+
```bash
258+
docker exec -it <container-id> /bin/bash
259+
```
260+
261+
262+
## Important settings
263+
264+
For production workloads, make sure the [Linux setting](https://www.kernel.org/doc/Documentation/sysctl/vm.txt) `vm.max_map_count` is set to at least 262144. On the Open Distro for Elasticsearch Docker image, this setting is the default. To verify, start a Bash session in the container and run:
265+
266+
```bash
267+
cat /proc/sys/vm/max_map_count
268+
```
269+
270+
To increase this value, you have to modify the Docker image. On the RPM install, you can add this setting to the host machine's `/etc/sysctl.conf` file by adding the following line:
271+
272+
```
273+
vm.max_map_count=262144
274+
```
275+
276+
Then run `sudo sysctl -p` to reload.
277+
278+
The `docker-compose.yml` file above also contains several key settings: `bootstrap.memory_lock=true`, `ES_JAVA_OPTS=-Xms512m -Xmx512m`, `nofile 65536` and `port 9600`. Respectively, these settings disable memory swapping (along with `memlock`), set the size of the Java heap (we recommend half of system RAM), set a limit of 65536 open files for the Elasticsearch user, and allow you to access Performance Analyzer on port 9600.
279+
280+
276281
## Customize the Docker image
277282

278283
To run the image with a custom plugin, first create a [`Dockerfile`](https://docs.docker.com/engine/reference/builder/):

docs/install/plugins.md

Lines changed: 79 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -264,64 +264,65 @@ Performance Analyzer requires some manual configuration after installing the plu
264264
sudo chmod +x /usr/share/elasticsearch/bin/performance-analyzer-agent-cli
265265
```
266266

267-
1. Run the appropriate postinst script for your Linux distro
267+
1. Run the appropriate `postinst` script for your Linux distribution:
268268

269-
```bash
270-
# DEB distros
269+
```bash
270+
# Debian-based distros
271271
sudo sh /usr/share/elasticsearch/plugins/opendistro_performance_analyzer/install/deb/postinst.sh 1
272-
272+
273273
# RPM distros
274274
sudo sh /usr/share/elasticsearch/plugins/opendistro_performance_analyzer/install/rpm/postinst.sh 1
275-
```
275+
```
276276

277277
1. Make Performance Analyzer accessible outside of the host machine
278278

279-
```bash
280-
cd /usr/share/elasticsearch # navigate to the Elasticsearch home directory
281-
cd plugins/opendistro_performance_analyzer/pa_config/
282-
vi performance-analyzer.properties
283-
```
284-
285-
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`. An example is provided below.
286-
```bash
287-
# ======================== Elasticsearch performance analyzer plugin config =========================
288-
289-
# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.
290-
291-
# WebService bind host; default to all interfaces
292-
webservice-bind-host = 0.0.0.0
293-
294-
# Metrics data location
295-
metrics-location = /dev/shm/performanceanalyzer/
296-
297-
# Metrics deletion interval (minutes) for metrics data.
298-
# Interval should be between 1 to 60.
299-
metrics-deletion-interval = 1
300-
301-
# If set to true, the system cleans up the files behind it. So at any point, we should expect only 2
302-
# metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving
303-
# the files and wouldn't like for them to be cleaned up.
304-
cleanup-metrics-db-files = true
305-
306-
# WebService exposed by App's port
307-
webservice-listener-port = 9600
308-
309-
# Metric DB File Prefix Path location
310-
metrics-db-file-prefix-path = /tmp/metricsdb_
311-
312-
https-enabled = false
313-
314-
#Setup the correct path for certificates
315-
certificate-file-path = specify_path
316-
317-
private-key-file-path = specify_path
318-
319-
# Plugin Stats Metadata file name, expected to be in the same location
320-
plugin-stats-metadata = plugin-stats-metadata
321-
322-
# Agent Stats Metadata file name, expected to be in the same location
323-
agent-stats-metadata = agent-stats-metadata
324-
```
279+
```bash
280+
cd /usr/share/elasticsearch # navigate to the Elasticsearch home directory
281+
cd plugins/opendistro_performance_analyzer/pa_config/
282+
vi performance-analyzer.properties
283+
```
284+
285+
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`:
286+
287+
```bash
288+
# ======================== Elasticsearch performance analyzer plugin config =========================
289+
290+
# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.
291+
292+
# WebService bind host; default to all interfaces
293+
webservice-bind-host = 0.0.0.0
294+
295+
# Metrics data location
296+
metrics-location = /dev/shm/performanceanalyzer/
297+
298+
# Metrics deletion interval (minutes) for metrics data.
299+
# Interval should be between 1 to 60.
300+
metrics-deletion-interval = 1
301+
302+
# If set to true, the system cleans up the files behind it. So at any point, we should expect only 2
303+
# metrics-db-file-prefix-path files. If set to false, no files are cleaned up. This can be useful, if you are archiving
304+
# the files and wouldn't like for them to be cleaned up.
305+
cleanup-metrics-db-files = true
306+
307+
# WebService exposed by App's port
308+
webservice-listener-port = 9600
309+
310+
# Metric DB File Prefix Path location
311+
metrics-db-file-prefix-path = /tmp/metricsdb_
312+
313+
https-enabled = false
314+
315+
#Setup the correct path for certificates
316+
certificate-file-path = specify_path
317+
318+
private-key-file-path = specify_path
319+
320+
# Plugin Stats Metadata file name, expected to be in the same location
321+
plugin-stats-metadata = plugin-stats-metadata
322+
323+
# Agent Stats Metadata file name, expected to be in the same location
324+
agent-stats-metadata = agent-stats-metadata
325+
```
325326

326327
1. Start the Elasticsearch service:
327328

@@ -347,37 +348,41 @@ sudo bin/elasticsearch-plugin list
347348

348349
## Remove plugins
349350

350-
### (Optional) Cleanup Performance Analyzer files
351+
If you are removing Performance Analyzer, see below.
352+
353+
```bash
354+
sudo bin/elasticsearch-plugin remove <plugin-name>
355+
```
356+
357+
Then restart Elasticsearch on the node.
358+
359+
```bash
360+
sudo systemctl restart elasticsearch.service
361+
```
362+
351363

352-
Performance Analyzer relies on certain config files to run. If you want to delete these files, run one of the
353-
scripts we've provided based on your Linux distribution
364+
### (Optional) Clean up Performance Analyzer files
354365

355-
1. Make the removal scripts executable
366+
Performance Analyzer requires certain configuration files to run. If you want to delete these files, run one of the scripts we provide based on your Linux distribution *before* performing the normal plugin removal process.
356367

357-
```bash
358-
sudo chmod +x plugins/opendistro_performance_analyer/install/deb/postrm sudo sh plugins/opendistro_performance_analyer/install/rpm/postrm
359-
```
368+
1. Make the removal scripts executable
360369

361-
1. Run the appropriate removal script for your distribution
362-
```bash
363-
# Debian distribution
364-
sudo --preserve-env=ES_HOME ./plugins/opendistro_performance_analyer/install/deb/postrm
365-
366-
# Redhat distribution
367-
sudo --preserve-env=ES_HOME ./plugins/opendistro_performance_analyer/install/rpm/postrm
368-
```
370+
```bash
371+
sudo chmod +x plugins/opendistro_performance_analyer/install/deb/postrm sudo sh plugins/opendistro_performance_analyer/install/rpm/postrm
372+
```
369373

370-
1. Then you can proceed with the normal removal procedure.
374+
1. Run the appropriate removal script for your distribution:
371375

372-
```bash
373-
sudo bin/elasticsearch-plugin remove <plugin-name>
374-
```
376+
```bash
377+
# Debian-based distros
378+
sudo --preserve-env=ES_HOME ./plugins/opendistro_performance_analyer/install/deb/postrm
379+
380+
# RPM distros
381+
sudo --preserve-env=ES_HOME ./plugins/opendistro_performance_analyer/install/rpm/postrm
382+
```
375383

376-
1. Finally, restart Elasticsearch on the node.
384+
Then proceed with the normal removal procedure.
377385

378-
```bash
379-
sudo systemctl restart elasticsearch.service
380-
```
381386

382387
## Update plugins
383388

docs/install/rpm.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,22 @@ sudo /bin/systemctl enable elasticsearch.service
9999

100100
You can also modify the values in `/etc/sysconfig/elasticsearch` (`JAVA_HOME`, most notably), `/etc/elasticsearch/elasticsearch.yml`, and `/etc/elasticsearch/jvm.options` (to set the heap size, most notably). To learn more, see [Elasticsearch configuration](../../elasticsearch/configuration/) and [Important Settings](../docker#important-settings) on the Docker page.
101101

102-
### Setup Performance Analyzer
103102

104-
By default, Performance Analyzer's endpoints will not be accessible from outside the host machine.
103+
### (Optional) Set up Performance Analyzer
105104

106-
To edit this behavior you'll need to modify the plugin configuration. First navigate to your `ES_HOME` which is `/usr/share/elasticsearch` for a standard installation.
105+
By default, Performance Analyzer's endpoints are not accessible from outside the host machine.
106+
107+
To edit this behavior, modify the plugin configuration. First navigate to `ES_HOME`, which is `/usr/share/elasticsearch` for a standard installation.
107108

108109
```bash
109110
cd $ES_HOME # navigate to the Elasticsearch home directory
110111
cd plugins/opendistro_performance_analyzer/pa_config/
111112
vi performance-analyzer.properties
112113
```
113114

114-
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`. An example is provided below.
115-
```bash
115+
Uncomment the line `#webservice-bind-host` and set it to `0.0.0.0`:
116+
117+
```
116118
# ======================== Elasticsearch performance analyzer plugin config =========================
117119
118120
# NOTE: this is an example for Linux. Please modify the config accordingly if you are using it under other OS.
@@ -152,7 +154,8 @@ plugin-stats-metadata = plugin-stats-metadata
152154
agent-stats-metadata = agent-stats-metadata
153155
```
154156

155-
Finally, restart the Elasticsearch service and PerformanceAnalyzer will be accessible from outside the machine.
157+
Finally, restart the Elasticsearch service. After the restart, Performance Analyzer is accessible from outside the machine:
158+
156159
```bash
157160
sudo systemctl restart elasticsearch.service
158161
```

0 commit comments

Comments
 (0)