Запуск/остановка/перезапуск кластера

Материал из Документация Ключ-АСТРОМ

Программное обеспечение Ключ-АСТРОМ Managed состоит из ряда служб Ключ-АСТРОМ, которые зависят друг от друга и должны быть остановлены или запущены в определенном порядке. Вы можете использовать официальный сценарий dynatrace.sh с дополнительными параметрами для правильного запуска, остановки или перезапуска служб Ключ-АСТРОМ. По умолчанию сценарий находится в /opt/dynatrace-managed/launcher/. Убедитесь, что у сценария dynatrace.sh есть разрешения на выполнение.

Вы можете выполнить сценарий dynatrace.sh с параметром (start, stop, restart, status, check, pid), как описано ниже.

  • start

Запускает все необходимые службы Ключ-АСТРОМ Managed в рекомендованном порядке.

[root@localhost]# ./dynatrace.sh start

  • stop

Останавливает все необходимые службы Ключ-АСТРОМ Managed в рекомендованном порядке.

[root@localhost]# ./dynatrace.sh stop

  • restart

Перезапускает все необходимые службы Ключ-АСТРОМ Managed в рекомендованном порядке.

[root@localhost]# ./dynatrace.sh restart

  • status

Отображает список необходимых служб Ключ-АСТРОМ и состояние каждой из них, включая подробную информацию о каждой службе:

[root@localhost]# ./dynatrace.sh status

Пример вывода статуса dynatrace.sh

  1. ● dynatrace-firewall.service - Dynatrace Firewall settings
  2.    Loaded: loaded (/etc/systemd/system/dynatrace-firewall.service; enabled; vendor preset: enabled)
  3.    Active: active (exited) since Tue 2019-07-09 08:34:54 UTC; 1 months 3 days ago
  4. Main PID: 12967 (code=exited, status=0/SUCCESS)
  5.     Tasks: 0
  6.    Memory: 0B
  7.       CPU: 0
  8.    CGroup: /system.slice/dynatrace-firewall.service
  9. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  10. ● dynatrace-nodekeeper.service - Dynatrace Nodekeeper
  11.    Loaded: loaded (/etc/systemd/system/dynatrace-nodekeeper.service; enabled; vendor preset: enabled)
  12.   Active: active (running) since Tue 2019-07-09 08:30:02 UTC; 1 months 3 days ago
  13.     Tasks: 69 (limit: 32768)
  14.    Memory: 389.2M
  15.       CPU: 2h 9min 51.936s
  16.    CGroup: /system.slice/dynatrace-nodekeeper.service
  17.            ├─  552 /opt/managed/nodekeeper/jre/bin/java -Xms239M -Xmx239M -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=60 -Duser.language=EN -Djava.io.tmpdir=...
  18.            ├─  966 /bin/sh /opt/managed/nodekeeper/services/watchdog.sh watch /opt/managed/nodekeeper/services/nodekeeper.sh
  19.           └─22167 sleep 60
  20. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  21. ● dynatrace-cassandra.service - Dynatrace Cassandra
  22.    Loaded: loaded (/etc/systemd/system/dynatrace-cassandra.service; enabled; vendor preset: enabled)
  23.    Active: active (running) since Tue 2019-07-09 08:37:52 UTC; 1 months 3 days ago
  24.     Tasks: 199 (limit: 32768)
  25.    Memory: 3.2G
  26.       CPU: 17h 1min 32.540s
  27.    CGroup: /system.slice/dynatrace-cassandra.service
  28.            ├─13690 /opt/managed/jre/bin/java -javaagent:/opt/managed/cassandra/bin/../lib/jamm-0.3.0.jar -XX:+CMSClassUnloadingEnabled -XX:+UseThreadPriorities -XX:ThreadPr...
  29.            ├─13721 /bin/sh /opt/managed/services/watchdog.sh watch /opt/managed/services/cassandra.sh
  30.            └─22197 sleep 60
  31. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  32. ● dynatrace-elasticsearch.service - Dynatrace Elasticsearch
  33.    Loaded: loaded (/etc/systemd/system/dynatrace-elasticsearch.service; enabled; vendor preset: enabled)
  34.    Active: active (running) since Tue 2019-07-09 08:38:15 UTC; 1 months 3 days ago
  35.     Tasks: 58 (limit: 32768)
  36.    Memory: 884.6M
  37.       CPU: 6h 59min 48.051s
  38.    CGroup: /system.slice/dynatrace-elasticsearch.service
  39.            ├─14802 /opt/managed/jre/bin/java -Xms558M -Xmx558M -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysP...
  40.            ├─14834 /bin/sh /opt/managed/services/watchdog.sh watch /opt/managed/services/elasticsearch.sh
  41.            └─21975 sleep 60
  42. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  43. ● dynatrace-server.service - Dynatrace Server
  44.    Loaded: loaded (/etc/systemd/system/dynatrace-server.service; enabled; vendor preset: enabled)
  45.    Active: active (running) since Tue 2019-07-09 08:39:01 UTC; 1 months 3 days ago
  46. Main PID: 2927 (code=exited, status=0/SUCCESS)
  47.     Tasks: 475 (limit: 32768)
  48.    Memory: 1.6G
  49.       CPU: 1d 3h 10min 18.812s
  50.    CGroup: /system.slice/dynatrace-server.service
  51.            ├─15294 /opt/managed/server/dynatraceserver -vm=/opt/managed/jre/bin/java -vmargs -Xms2873M -Xmx2873M -XX:-OmitStackTraceInFastThrow -XX:+UseConcMarkSweepGC -XX:...
  52.            └─15302 /opt/managed/jre/bin/java -Dcom.compuware.apm.WatchDogPort=50004 -classpath :/opt/managed/server/lib/ace-1.4.4-dt-2.0.jar:/opt/managed/server/lib/acme4j-...
  53. Aug 12 13:04:05 ip-10-176-32-69 sudo[20856]: pam_unix(sudo:session): session closed for user root
  54. Aug 12 13:04:05 ip-10-176-32-69 sudo[21125]:  dynaman : TTY=unknown ; PWD=/opt/managed/server ; USER=root ; COMMAND=/opt/dtrun/dtrun service dynatrace-cassandra status
  55. Aug 12 13:04:05 ip-10-176-32-69 sudo[21125]: pam_unix(sudo:session): session opened for user root by (uid=0)
  56. Aug 12 13:04:05 ip-10-176-32-69 sudo[21125]: pam_unix(sudo:session): session closed for user root
  57. Aug 12 13:04:05 ip-10-176-32-69 sudo[21389]:  dynaman : TTY=unknown ; PWD=/opt/managed/server ; USER=root ; COMMAND=/opt/dtrun/dtrun service dynatrace-security-gateway status
  58. Aug 12 13:04:05 ip-10-176-32-69 sudo[21389]: pam_unix(sudo:session): session opened for user root by (uid=0)
  59. Aug 12 13:04:05 ip-10-176-32-69 sudo[21389]: pam_unix(sudo:session): session closed for user root
  60. Aug 12 13:04:05 ip-10-176-32-69 sudo[21665]:  dynaman : TTY=unknown ; PWD=/opt/managed/server ; USER=root ; COMMAND=/opt/dtrun/dtrun service dynatrace-server status
  61. Aug 12 13:04:05 ip-10-176-32-69 sudo[21665]: pam_unix(sudo:session): session opened for user root by (uid=0)
  62. Aug 12 13:04:05 ip-10-176-32-69 sudo[21665]: pam_unix(sudo:session): session closed for user root
  63. Hint: Some lines were ellipsized, use -l to show in full.
  64. ● dynatrace-security-gateway.service - Dynatrace Active Gate
  65.    Loaded: loaded (/etc/systemd/system/dynatrace-security-gateway.service; enabled; vendor preset: enabled)
  66.    Active: active (running) since Tue 2019-07-09 08:39:37 UTC; 1 months 3 days ago
  67. Main PID: 16173 (dynatracegatewa)
  68.     Tasks: 247 (limit: 32768)
  69.    Memory: 410.7M
  70.       CPU: 3h 44min 58.189s
  71.    CGroup: /system.slice/dynatrace-security-gateway.service
  72.            ├─16173 /opt/managed/security-Gateway/launcher/dynatracegateway -bg -vm=/opt/managed/jre/bin/java -vmargs -Xms638M -Xmx638M -XX:+UseConcMarkSweepGC -XX:CMSInitia...
  73.            └─16182 /opt/managed/jre/bin/java -Dcom.compuware.apm.WatchDogPort=50005 -classpath /opt/managed/security-Gateway/lib/* -XX:ErrorFile=/var/opt/managed/log/securi...
  74. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  75. ● dynatrace-nginx.service - Dynatrace NGINX
  76.    Loaded: loaded (/etc/systemd/system/dynatrace-nginx.service; enabled; vendor preset: enabled)
  77.    Active: active (running) since Tue 2019-07-09 08:39:46 UTC; 1 months 3 days ago
  78.     Tasks: 14 (limit: 32768)
  79.    Memory: 92.7M
  80.       CPU: 40min 38.507s
  81.    CGroup: /system.slice/dynatrace-nginx.service
  82.            ├─17152 nginx: OneAgent companion process
  83.            ├─17153 nginx: master process /opt/managed/nginx/sbin/nginx -c /opt/managed/nginx/conf/nginx.conf
  84.            ├─17155 nginx: worker process
  85.            ├─17156 nginx: worker process
  86.            ├─17164 /bin/bash /opt/managed/services/logs-watcher.sh watch-nginx /var/opt/managed/log/nginx/access.log /var/opt/managed/log/nginx/error.log
  87.            └─19214 sleep 600
  88. Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
  89. All services are OK
  • check

Проверяет состояние правил iptable и процессов для Nodekeeper, Cassandra, Elasticsearch, АктивногоШлюза, Watcher и NGINX.

[root@localhost]# ./dynatrace.sh check

Пример вывода статуса dynatrace.sh

  1. Checking rules in iptables ...
  2. Rule is present in 'filter': INPUT -p tcp -m tcp -m multiport --ports 443,5701:5711,7000:7001,7199,8018:8022,8443,9042,9200,9300,9998 -j DROP
  3. Rule is present in 'filter': OUTPUT -p tcp -m tcp -m multiport --ports 443,5701:5711,7000:7001,7199,8018:8022,8443,9042,9200,9300,9998 -j ACCEPT
  4. Rule is present in 'filter': INPUT -p tcp -m addrtype --src-type LOCAL -m tcp -m multiport --ports 443,5701:5711,7000:7001,7199,8018:8022,8443,9042,9200,9300,9998 -j ACCEPT
  5. Rule is present in 'filter': INPUT -s 10.10.10.10/32 -p tcp -m tcp -m multiport --ports 5701:5711,7000:7001,7199,8019,9042,9200,9300 -j ACCEPT
  6. Rule is present in 'filter': INPUT -p tcp -m tcp -m multiport --ports 443,8020:8022,8443,9998 -j ACCEPT
  7. Rule is present in 'filter': FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  8. Rule is present in 'nat': PREROUTING -p tcp -m addrtype --dst-type LOCAL -m tcp --dport 443 -j REDIRECT --to-ports 8022
  9. Rule is present in 'nat': OUTPUT -p tcp -m addrtype --dst-type LOCAL -m tcp --dport 443 -j REDIRECT --to-ports 8022
  10. All rules are active.
  11. Nodekeeper is running at launcher PID: 966, main PID: 552, listening on ports 8018
  12. Cassandra is running at launcher PID: 13721, main PID: 13690, listening on ports 9042
  13. Elasticsearch is running at launcher PID: 14834, main PID: 14802, listening on ports 9200,9300
  14. {
  15.   "cluster_name" : "11bc1cd1e1-c222-33e3-4f44-0e0bc0dcdc0d",
  16.   "status" : "yellow",
  17.   "timed_out" : false,
  18.   "number_of_nodes" : 1,
  19.   "number_of_data_nodes" : 1,
  20.   "active_primary_shards" : 299,
  21.   "active_shards" : 299,
  22.   "relocating_shards" : 0,
  23.   "initializing_shards" : 0,
  24.   "unassigned_shards" : 598,
  25.   "delayed_unassigned_shards" : 0,
  26.   "number_of_pending_tasks" : 0,
  27.   "number_of_in_flight_fetch" : 0,
  28.   "task_max_waiting_in_queue_millis" : 0,
  29.   "active_shards_percent_as_number" : 33.33333333333333
  30. }
  31. Server is running at launcher PID: 15294, main PID: 15302, listening on ports 8021
  32. ActiveGate is running at launcher PID: 16173, main PID: 16182, listening on ports 8443
  33. Command to run as user dynaman: /opt/managed/services/logs-watcher.sh status
  34. Watcher is running, reporting in log: /var/opt/managed/log/logs-watcher-for-nginx-logs.log
  35. NGINX is running at launcher PID: 17153, main PID: 17155 17156, listening on ports 8022
  36. All processes are OK
  • pid

Отображает идентификатор процесса для всех необходимых служб Ключ-АСТРОМ, которые были запущены с помощью скрипта dynatrace.sh.

[root@localhost]# ./dynatrace.sh pid

Пример pid статуса dynatrace.sh

966 552 13721 13690 14834 14802 15294 15302 16173 16182 17153 17155 17156