-
docker命令:
进入docker容器:docker exec -it xxx(docker name) bash
docker重启:docker restart xxx(docker name)
查看docker详情:runlike xxx(docker name)
创建docker容器:docker run --name=converterScript --env=TZ=Asia/Shanghai --volume=/etc/localtime:/etc/localtime --volume=/data/converterScript/app:/app --volume=/data/converterScript/etc/hosts:/etc/hosts --volume=/logsScript:/logs --expose=8010 --expose=8011 -p 8082:8081 --restart=no --runtime=runc --detach=true -t boss:v1 java -jar /app/app.jar -
Python命令:
安装Python包:pip3 install xxx
启动Python程序:nohup python3 app_start.py > nohup.log 2>&1 &
导出三方依赖到requirements.txt:pipreqs ./ --encoding=utf-8
安装requirements.txt中的包:pip3 install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --upgrade -
安装Java环境:
安装jdk8:sudo yum install java-1.8.0-openjdk* -y -
clickhouse命令:
打开clickhouse客户端:clickhouse-client --user=用户名 --password=密码
从远程server复制数据到本地:insert into 表名 select * from remote(‘192.168.1.2:9000’,库名,表名,‘用户名’,'密码) where 条件;
查看clickhouse后台运行任务SQL:
SELECT database,table,command,create_time,is_done FROM system.mutations where is_done = 0 and command like ‘SELECT%’;
删除后台运行任务SQL:KILL MUTATION WHERE database = ‘库名’ AND table = ‘表名’;
clickhouse删除数据:alter table 表名 delete where 条件;
重启clickhouse:systemctl restart clickhouse-server.service -
查看io:
监控磁盘io命令:iostat -x 1 -
JVM:
查看jvm内存对象占用内存大小和对象个数:jmap -histo 进程ID
查看jvm线程运行状态:jstack -F 进程ID -
C++:
cmake …
cmake … -DCMAKE_BUILD_TYPE=Realse
make
make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:…/lib:/usr/local/lib/third_party:/usr/local/lib/
./algoservice -f …/config/dump.xml
nohup ./algoservice -f …/config/dump_test.xml & -
系统定时任务:
0 8 * * 1-5 cd /opt/converter/app && ./restartConverter.sh
0 17 * * 1-5 docker restart converter -
SMB
yum -y install samba-client samba-common cifs-rtils samba
#!/bin/bash
SMB_PATH="//192.168.1.24/share"
CONTAINER_NAME="my-container"
# Loop until the SMB path exists
while true; do
# Check if the SMB path exists
if smbclient -A /dev/null $SMB_PATH -U renee%1234 -c "ls" >/dev/null 2>&1; then
echo "SMB path $SMB_PATH exists"
break
else
echo "SMB path $SMB_PATH does not exist, restarting container $CONTAINER_NAME..."
# docker restart $CONTAINER_NAME
sleep 30
fi
done
启动命令:
nohup ./checkSmb.sh 2>&1 &