7.8 KiB
lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT loop0 7:0 0 3.6G 0 loop /mnt/dvd sr0 11:0 1 30.6M 0 rom sr1 11:1 1 1024M 0 rom vda 252:0 0 30G 0 disk ├─vda1 252:1 0 200M 0 part /boot ├─vda2 252:2 0 8G 0 part [SWAP] └─vda3 252:3 0 21.8G 0 part / vdb 252:16 0 70G 0 disk └─vdb1 252:17 0 70G 0 part /opt vdc 252:32 0 250G 0 disk
tomcat : x-forward-for:
<!-- Remote IP Valve -->
<Valve className="org.apache.catalina.valves.RemoteIpValve" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="combined" resolveHosts="false"/>
docker ce install
download docker binary
http://mirrors.aliyun.com/docker-ce/linux/static/stable
tar xzvf docker-27.3.1.tgz
cp docker/* /usr/loca/sbin/
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/local/sbin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=infinity
LimitNPROC=infinity
TimeoutStartSec=0
Delegate=yes
KillMode=process
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
docker save
docker run -d \
--name haproxy \
-p 80:80 \
-p 443:443 \
-p 3306:3306 \
-v ./config/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro \
haproxy:3.0.6
gzii-db-2: lookbusy:
#!/bin/bash
/usr/local/bin/lookbusy -c 10-30 --cpu-mode curve --cpu-curve-period 60m --cpu-curve-peak 30m cpu &
disk:
fallocate -l 240G /opt/tmp/data.zip
sql timeout
Steps:
-
Create a new rule for
jmwrapid:INSERT INTO mysql_query_rules (active, username, match_pattern, replace_pattern, timeout, flagIN, destination_hostgroup) VALUES (1, 'jmwrapid', '.*', 'SET SESSION max_execution_time=30000;', 0, 0, 10);This rule sets a maximum execution time of 30 seconds (30000 milliseconds) for all queries executed by the
jmwrapiduser. -
Load the rule into runtime and save it:
LOAD MYSQL QUERY RULES TO RUNTIME; SAVE MYSQL QUERY RULES TO DISK; -
Verify the rule:
SELECT * FROM mysql_query_rules WHERE username = 'jmwrapid';
This will apply the SQL timeout specifically for jmwrapid. Let me know if you need more adjustments!
UPDATE mysql_query_rules
SET timeout = 60
WHERE username = 'jmwrapid' AND match_pattern = '.*';
INSERT INTO mysql_query_rules (active, username, match_pattern, timeout, flagIN, destination_hostgroup)
VALUES (1, 'jmwrapid', '.*', 60, 0, 10);
To update a Docker container's timezone, you can follow these steps:
1. Update Timezone in a Running Container
If the container is already running, you can change the timezone by:
a. Using exec to set the timezone
Run the following command to set the timezone in the container:
docker exec -it <container_name> ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime
For example, to set the timezone to America/New_York:
docker exec -it <container_name> ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
b. Set the timezone environment variable
You can also set the TZ environment variable in the container:
docker exec -it <container_name> sh -c "echo 'America/New_York' > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata"
2. Set Timezone at Container Creation
To ensure the correct timezone is set when you start a container, you can configure the timezone during container creation.
a. Add a TZ environment variable
Use the -e flag to set the TZ environment variable:
docker run -e TZ=America/New_York -d <image_name>
b. Mount the /etc/localtime file
You can mount the host system's timezone file into the container:
docker run -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -d <image_name>
This ensures the container uses the same timezone as the host system.
3. Update Dockerfile for Persistent Changes
If you want all containers created from a specific image to have a pre-configured timezone, you can modify the Dockerfile:
FROM <base_image>
ENV TZ=America/New_York
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Then rebuild the image:
docker build -t <new_image_name> .
4. Verify the Timezone
You can verify the timezone in the container by checking the current date and time:
docker exec -it <container_name> date
Summary:
- Use
docker execto update the timezone in a running container. - Configure the timezone at container creation using
-e TZor mounting/etc/localtime. - Modify the
Dockerfilefor persistent timezone settings.
Let me know if you need further clarification!
docker exec --user root -it proxysql ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
docker exec -it proxysql mysql -h 127.0.0.1 -u admin -padmin -P6032 -e "SET GLOBAL time_zone = 'Asia/Shanghai';"
docker exec -it gzii-db-3 mysql -u root -h 127.0.0.1 -pwc97fjvDg:Ywgyad mysql -e "SET GLOBAL time_zone = 'Asia/Shanghai';"
docker cp /usr/share/zoneinfo/Asia/Shanghai gzii-db-3:/usr/share/zoneinfo/Asia/Shanghai
docker exec -it -u root gzii-db-3 sh -c "echo 'Asia/Shanghai' > /etc/timezone"
docker exec -u root gzii-db-3 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
docker cp /usr/share/zoneinfo/Asia/Shanghai gzii-db-4:/usr/share/zoneinfo/Asia/Shanghai
docker exec -it -u root gzii-db-4 sh -c "echo 'Asia/Shanghai' > /etc/timezone"
docker exec -u root gzii-db-4 ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
17:
cpu 内存:
/usr/local/bin/lookbusy -c 10-70 --cpu-mode curve --cpu-curve-period 60m --cpu-curve-peak 30m cpu -m 19GB -M 3000 &
auth 失败处理
docker run -d \
--name etcd \
--net host \
-v /usr/share/ca-certificates/:/etc/ssl/certs \
-v /opt/etcd/data:/etcd-data \
quay.io/coreos/etcd:v3.4.35 \
/usr/local/bin/etcd \
--enable-v2=true \
--name etcd0 \
--data-dir /etcd-data \
--listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
--advertise-client-urls http://10.194.64.102:2379,http://10.194.64.102:4001 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://10.194.64.102:2380 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd0=http://10.194.64.102:2380 \
--initial-cluster-state new
docker exec -e ETCDCTL_API=3 etcd etcdctl --endpoints=http://127.0.0.1:2379 endpoint health
docker exec -e ETCDCTL_API=3 etcd etcdctl user add root --new-user-password="IeGheikae.Woo5ph"
docker exec etcd etcdctl --endpoints=http://gzii-db-3:2379 role add root
docker exec etcd etcdctl --endpoints=http://gzii-db-3:2379 role grant-permission root --prefix=true readwrite /
docker exec etcd etcdctl --endpoints=http://gzii-db-3:2379 user grant-role root root
docker exec etcd etcdctl --endpoints=http://gzii-db-3:2379 auth enable
docker exec -e ETCDCTL_API=3 etcd etcdctl --user=root:IeGheikae.Woo5ph member list
安装探测器:
curl -k https://10.207.33.1:9000/up-install/up-install.sh | bash -x
traceroute -T -p 9000 10.207.33.1
backup etcd
docker exec etcd etcdctl \
--endpoints=http://10.194.64.102:2379 \
--user=root:IeGheikae.Woo5ph \
snapshot save /etcd-data/backup-$(date +%Y%m%d-%H%M%S).db