RELEEM_MYSQL_PASSWORD='[Password]' RELEEM_MYSQL_LOGIN='releem' RELEEM_MYSQL_MEMORY_LIMIT=0 RELEEM_API_KEY=[Key] RELEEM_CRON_ENABLE=1 bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)"
docker run -d -ti --name 'releem-agent' -e RELEEM_HOSTNAME="[Hostname]" -e DB_HOST="[DB_HOST]" -e DB_PORT="[DB_PORT]" -e DB_PASSWORD="[RELEEM_MYSQL_PASSWORD]" -e DB_USER="releem" -e RELEEM_API_KEY="[RELEEM_API_KEY]" -e MEMORY_LIMIT=[MEMORY_LIMIT] releem/releem-agent:1.5.0.3
version: '3.7'
services:
releem-agent:
image: releem/releem-agent
container_name: releem-agent
environment:
MEMORY_LIMIT: "${MEMORY_LIMIT}"
DB_USER: "releem"
RELEEM_API_KEY: "${RELEEM_API_KEY}"
DB_PASSWORD: "${RELEEM_MYSQL_PASSWORD}"
DB_PORT: "${DB_PORT}"
DB_HOST: "${DB_HOST}"
restart: unless-stopped
volumes:
- /tmp/.mysqlconfigurer/:/tmp/.mysqlconfigurer/
- /etc/mysql/releem.conf.d/:/etc/mysql/releem.conf.d/
performance_schema = 1
slow_query_log = 1
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: releem-agent-claim0-primary
namespace: your-name-space
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: releem-agent-claim1-primary
namespace: your-name-space
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: releem-agent-claim0-secondary
namespace: your-name-space
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: releem-agent-claim1-secondary
namespace: your-name-space
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: releem-agent-primary
namespace: your-name-space
labels:
tier: backend
version: 1.0.1
spec:
selector:
matchLabels:
app: releem-agent-primary
tier: backend
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: releem-agent-primary
tier: backend
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: use
operator: In
values:
- database
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: statefulset.kubernetes.io/pod-name
operator: In
values:
- your-name-space-mariadb-primary-0
topologyKey: kubernetes.io/hostname
containers:
- name: releem-agent-primary
image: releem/releem-agent:1.12.0
imagePullPolicy: IfNotPresent
env:
- name: MEMORY_LIMIT
value: "28672"
- name: DB_USER
value: "your-user"
- name: RELEEM_API_KEY
value: "your-key"
- name: DB_PASSWORD
value: "your-passw"
- name: DB_PORT
value: "3306"
- name: DB_HOST
value: "your-db-service"
volumeMounts:
- mountPath: /opt/releem/conf/
name: releem-agent-claim0
- mountPath: /etc/mysql/releem.conf.d/
name: releem-agent-claim1
restartPolicy: Always
volumes:
- name: releem-agent-claim0
persistentVolumeClaim:
claimName: releem-agent-claim0-primary
- name: releem-agent-claim1
persistentVolumeClaim:
claimName: releem-agent-claim1-primary
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: releem-agent-secondary
namespace: your-name-space
labels:
tier: backend
version: 1.0.1
spec:
selector:
matchLabels:
app: releem-agent-secondary
tier: backend
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: releem-agent-secondary
tier: backend
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: use
operator: In
values:
- database
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: statefulset.kubernetes.io/pod-name
operator: In
values:
- your-name-space-mariadb-secondary-0
topologyKey: kubernetes.io/hostname
containers:
- name: releem-agent-secondary
image: releem/releem-agent:1.12.0
imagePullPolicy: IfNotPresent
env:
- name: MEMORY_LIMIT
value: "28672"
- name: DB_USER
value: "your-user"
- name: RELEEM_API_KEY
value: "your-key"
- name: DB_PASSWORD
value: "your-passw"
- name: DB_PORT
value: "3306"
- name: DB_HOST
value: "your-db-service"
volumeMounts:
- mountPath: /opt/releem/conf/
name: releem-agent-claim0
- mountPath: /etc/mysql/releem.conf.d/
name: releem-agent-claim1
restartPolicy: Always
volumes:
- name: releem-agent-claim0
persistentVolumeClaim:
claimName: releem-agent-claim0-secondary
- name: releem-agent-claim1
persistentVolumeClaim:
claimName: releem-agent-claim1-secondary
mkdir -p /opt/releem/ /opt/releem/conf /etc/mysql/releem.conf.d
curl -L -o /opt/releem/mysqlconfigurer.sh http://releem.s3.amazonaws.com/test/mysqlconfigurer.sh
curl -L -o /opt/releem/releem-agent http://releem.s3.amazonaws.com/test/releem-agent-$(arch)
chmod 755 /opt/releem/mysqlconfigurer.sh /opt/releem/releem-agent
echo -e '\n!includedir /etc/mysql/releem.conf.d' | tee -a /etc/mysql/my.cnf
( crontab -l 2>/dev/null | grep -v "/opt/releem/mysqlconfigurer.sh" || true; echo "00 00 * * * PATH=/bin:/sbin:/usr/bin:/usr/sbin /bin/bash /opt/releem/mysqlconfigurer.sh -u") | crontab -
cat <<EOT >> /opt/releem/releem.conf
apikey="api_key"
releem_cnf_dir="/opt/releem/conf"
mysql_user="releem"
mysql_password="[Password]"
mysql_restart_service="/etc/init.d/mysql restart"
mysql_cnf_dir="/etc/mysql/releem.conf.d"
EOT
/opt/releem/releem-agent -f ; timeout 3 /opt/releem/releem-agent
/opt/releem/releem-agent install ; /opt/releem/releem-agent start
/bin/bash /opt/releem/mysqlconfigurer.sh -u ;/bin/bash /opt/releem/mysqlconfigurer.sh -p
mkdir -p /opt/releem/ /opt/releem/conf /etc/mysql/releem.conf.d
curl -L -o /opt/releem/mysqlconfigurer.sh https://releem.s3.amazonaws.com/v2/mysqlconfigurer.sh
curl -L -o /opt/releem/releem-agent https://releem.s3.amazonaws.com/v2/releem-agent-$(arch)
chmod 755 /opt/releem/mysqlconfigurer.sh /opt/releem/releem-agent
echo -e '\n!includedir /etc/mysql/releem.conf.d' | tee -a /etc/my.cnf
( crontab -l 2>/dev/null | grep -v "/opt/releem/mysqlconfigurer.sh" || true; echo "00 00 * * * PATH=/bin:/sbin:/usr/bin:/usr/sbin /bin/bash /opt/releem/mysqlconfigurer.sh -u") | crontab -
cat <<EOT >> /opt/releem/releem.conf
apikey="api_key"
releem_cnf_dir="/opt/releem/conf"
mysql_user="releem"
mysql_password="[Password]"
mysql_restart_service="/etc/init.d/mysql restart"
mysql_cnf_dir="/etc/mysql/releem.conf.d"
EOT
/opt/releem/releem-agent -f ; timeout 5 /opt/releem/releem-agent
/opt/releem/releem-agent install ; /opt/releem/releem-agent start
/bin/bash /opt/releem/mysqlconfigurer.sh -u ; /bin/bash /opt/releem/mysqlconfigurer.sh -p
RELEEM_QUERY_OPTIMIZATION=true
RELEEM_MYSQL_ROOT_PASSWORD='password' /bin/bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)" enable_query_optimization
performance-schema-consumer-events-statements-history = ON
performance-schema-consumer-events-statements-current = ON
performance_schema_events_statements_history_size = 500
GRANT SELECT ON *.* TO releem@'%'
CREATE SCHEMA IF NOT EXISTS releem;
DELIMITER $$
CREATE PROCEDURE releem.enable_events_statements_consumers()
SQL SECURITY DEFINER
BEGIN
UPDATE performance_schema.setup_consumers SET enabled='YES' WHERE name LIKE 'events_statements_%';
END $$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE releem.enable_events_statements_consumers TO releem@'%';
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "0.60"
},
"table": {
"table_name": "sale_internals_order_discount",
"access_type": "ref",
"possible_keys": [
"IX_SALE_ORDER_DSC_HASH"
],
"key": "IX_SALE_ORDER_DSC_HASH",
"used_key_parts": [
"DISCOUNT_HASH"
],
"key_length": "98",
"ref": [
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 1,
"filtered": "100.00",
"cost_info": {
"read_cost": "0.50",
"eval_cost": "0.10",
"prefix_cost": "0.60",
"data_read_per_join": "1K"
},
"used_columns": [
"ID",
"MODULE_ID",
"DISCOUNT_ID",
"NAME",
"DISCOUNT_HASH",
"CONDITIONS",
"UNPACK",
"ACTIONS",
"APPLICATION",
"USE_COUPONS",
"SORT",
"PRIORITY",
"LAST_DISCOUNT",
"ACTIONS_DESCR"
]
}
}
}
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"rds:Describe*",
"cloudwatch:Get*",
"logs:Get*",
"ec2:Describe*"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
RELEEM_MYSQL_HOST='[RDS_ENDPOINT]' RELEEM_MYSQL_PASSWORD='[Password]' RELEEM_MYSQL_LOGIN='releem' RELEEM_MYSQL_MEMORY_LIMIT=0 RELEEM_API_KEY=[Key] RELEEM_CRON_ENABLE=1 bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)"
instance_type="aws/rds"
aws_region="[AWS_REGION]"
aws_rds_db="[RDS_INSTANCE_NAME]"
systemctl restart releem-agent
docker run -d -ti --restart=always --name 'releem-agent' -e DB_PASSWORD="[RELEEM_MYSQL_PASSWORD]" -e DB_USER="releem" -e RELEEM_API_KEY="[RELEEM_API_KEY]" -e INSTANCE_TYPE="aws/rds" -e AWS_RDS_DB="[RDS_INSTANCE_NAME]" releem/releem-agent:1.0.4.1
[mysqld]
query_cache_type = 1 ### Previous value : ON
query_cache_size = 128M ### Previous value : 134217728
query_cache_limit = 16M ### Previous value : 16777216
thread_cache_size = 8 ### Previous value : 8
key_buffer_size = 205520896 ### Previous value : 205520896
max_allowed_packet = 1073741824 ### Previous value : 67108864
sort_buffer_size = 16777216 ### Previous value : 25165824
read_rnd_buffer_size = 4194304 ### Previous value : 4194304
bulk_insert_buffer_size = 8M ### Previous value : 2097152
myisam_sort_buffer_size = 8388608 ### Previous value : 25165824
innodb_buffer_pool_instances = 2 ### Previous value : 3
innodb_buffer_pool_size = 3019898880 ### Previous value : 3019898880
max_heap_table_size = 256M ### Previous value : 268435456
tmp_table_size = 256M ### Previous value : 268435456
join_buffer_size = 8M ### Previous value : 8388608
max_connections = 151 ### Previous value : 151
table_open_cache = 3072 ### Previous value : 3072
table_definition_cache = 1920 ### Previous value : 1920
innodb_flush_log_at_trx_commit = 2 ### Previous value : 2
innodb_log_file_size = 377487360 ### Previous value : 805306368
innodb_write_io_threads = 4 ### Previous value : 4
innodb_read_io_threads = 4 ### Previous value : 4
innodb_file_per_table = 1 ### Previous value : ON
innodb_flush_method = O_DIRECT ### Previous value :
innodb_thread_concurrency = 0 ### Previous value : 0
CREATE USER 'releem'@'%' identified by '[Password]';
GRANT PROCESS, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'releem'@'%';
GRANT SELECT ON performance_schema.events_statements_summary_by_digest TO 'releem'@'%';
GRANT SELECT ON performance_schema.table_io_waits_summary_by_index_usage TO 'releem'@'%';
GRANT SELECT ON performance_schema.file_summary_by_instance TO 'releem'@'%';
GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'releem'@'%';
CREATE USER 'releem'@'%' identified by '[Password]';
GRANT PROCESS, REPLICATION CLIENT, SHOW VIEW ON *.* TO 'releem'@'%';
GRANT SELECT ON performance_schema.events_statements_summary_by_digest TO 'releem'@'%';
GRANT SELECT ON performance_schema.table_io_waits_summary_by_index_usage TO 'releem'@'%';
GRANT SELECT ON performance_schema.file_summary_by_instance TO 'releem'@'%';
GRANT SUPER ON *.* TO 'releem'@'%';
systemctl restart releem-agent
cp /opt/releem/conf/z_aiops_mysql.cnf /etc/mysql/conf.d/
service mysqld restart
mysql -e"SET GLOBAL innodb_fast_shutdown = 1"
service mysql stop
mv /var/lib/mysql/ib_logfile[01] /tmp
service mysql start
mkdir -p /opt/releem
curl -s -L -o /opt/releem/update_releem_docker.sh https://releem.s3.amazonaws.com/v2/update_releem_docker.sh
chmod +x /opt/releem/update_releem_docker.sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin bash /opt/releem/update_releem_docker.sh <container_name>
( crontab -l 2>/dev/null | grep -v "/opt/releem/update_releem_docker.sh" || true; echo "0 0 * * * PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin bash /opt/releem/update_releem_docker.sh <container_name> >> /tmp/update_releem_docker.log 2>&1") | crontab -
bash -c "$(curl -L https://releem.s3.amazonaws.com/v2/install.sh)" uninstall