• 常用脚本命令


    #!/bin/bash
    #sed -i 's/^export JAVA_HOME=.*$/export JAVA_HOME=/usr/local/jdk11/' /etc/profile.d/java.sh
    #source /etc/profile
    #node_name=`hostname`"-master"
    #sed -i "2 inode.name: $node_name" /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9200/elasticsearch-7.3.2/elasticsearch-7.3.2/config/elasticsearch.yml
    #sed -i "s/^node.name.*$/node.name: $node_name/" /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9202/elasticsearch-7.3.2/elasticsearch-7.3.2/config/elasticsearch.yml
    #su - esuser -c 'sh /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9200/elasticsearch-7.3.2/op_bin/shutdown.sh'
    #sleep 5
    #su - esuser -c 'sh /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9200/elasticsearch-7.3.2/op_bin/start.sh'
    #echo "OK"
    #cat /etc/centos-release
    #uname -a
    #df -h
    #ps -ef | grep java | grep -v grep | grep -v paas
    #yum -y update kernel
    #yum -y install fio
    #mkdir -p /home/service/var/test
    #cd /home/service/var/test
    #fio --directory=./ -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psync -bs=4k -size=500MB -numjobs=50 -runtime=60 -group_reporting -name=mytest
    #cd /home/service/var/
    #rm -rf test
    #cpupower frequency-set -g performance
    #sleep 3
    #cat /etc/centos-release
    #df -h
    #cd /home/service/app/kafka
    #sh start.sh
    #wget http://midpackage-bjsm.oppoer.me/mlocate-0.22.2-6.el6.x86_64.rpm
    #rpm -ivh mlocate-0.22.2-6.el6.x86_64.rpm
    #updatedb
    #curl -s http://10.12.29.98:8090/tools/auto_init.sh|sh
    #tcpdump -i bond0 -c 300000 -w `hostname -i`.pcap
    #ps -ef | grep java | grep -v paas | grep -v grep 
    #df -h
    
    #*******Elasticsearch*******
    # sysctl -w vm.max_map_count=655360
    # echo 'vm.max_map_count=655360' >> /etc/sysctl.conf
    # chown -R service.service /home/service/app/elasticsearch
    
    # host_ip=`hostname -I`
    #host_name=`hostname`"-warm"
    # cd /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9202/elasticsearch-7.3.2/elasticsearch-7.3.2
    # wget http://midpackage-bjsm.oppoer.me/config_cool.tgz
    # mv config config.bak
    # tar zxf config_cool.tgz
    # sed -i "s/^network.host.*$/network.host: $host_ip/" /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9202/elasticsearch-7.3.2/elasticsearch-7.3.2/config/elasticsearch.yml
    #sed -i "s/^node.name.*$/node.name: $host_name/" /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9202/elasticsearch-7.3.2/elasticsearch-7.3.2/config/elasticsearch.yml
    # cd /home/service/var/esuser/9202/nodes/0
    # rm -rf node.lock _state
    # sleep 2
    #chmod +x /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9201/elasticsearch-7.3.2/op_bin/start.sh
    #chmod +x /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9201/elasticsearch-7.3.2/op_bin/shutdown.sh
    #su - esuser -c 'sh /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9201/elasticsearch-7.3.2/elasticsearch-7.3.2/bin/elasticsearch-plugin install http://midpackage-bjsm.oppoer.me/prometheus-exporter-7.3.2.0.zip'
    #su - esuser -c 'sh /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9200/elasticsearch-7.3.2/op_bin/shutdown.sh'
    #su - esuser -c 'sh /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9200/elasticsearch-7.3.2/op_bin/start.sh'
    
    # mkdir -p /home/service/var/elasticsearch/data
    # mkdir -p /home/service/var/elasticsearch/logs
    # chown -R service.service /home/service/var/elasticsearch
    # sh /home/service/app/elasticsearch/start.sh
    # ps -ef | grep elasticsearch | grep -v grep
    # echo '*/1 * * * * root /bin/bash /home/service/app/elasticsearch/start.sh >> /tmp/crontab_es.log 2>&1 &' >> /etc/crontab
    #*******Elasticsearch*******
    
    # cd /home/service/app/elasticsearch
    # rm -rf start.sh
    # wget http://midpackage-bjsm.oppoer.me/elasticsearch/start.sh
    # chown service.service start.sh
    # echo '*/1 * * * * root /bin/bash /home/service/app/elasticsearch/start.sh >> /tmp/crontab_es.log 2>&1 &' >> /etc/crontab
    
    # sysctl -w vm.min_free_kbytes=20000000
    # echo 'vm.min_free_kbytes=20000000' >> /etc/sysctl.conf
    
    #sed -i 's/^-Xms.*$/-Xms12g/' /web/esuser/f57a16a2-0a6b-4bbe-b51e-0d42e3fb/9203/elasticsearch-5.1.2/elasticsearch-5.1.2/config/jvm.options
    #sed -i 's/^-Xmx.*$/-Xmx12g/' /web/esuser/f57a16a2-0a6b-4bbe-b51e-0d42e3fb/9203/elasticsearch-5.1.2/elasticsearch-5.1.2/config/jvm.options
    
    #sed -i 's/^discovery.zen.ping_timeout.*$/discovery.zen.ping_timeout: 30s/' /web/esuser/f57a16a2-0a6b-4bbe-b51e-0d42e3fb/9203/elasticsearch-5.1.2/elasticsearch-5.1.2/config/elasticsearch.yml
    #sed -i 's/^discovery.zen.fd.ping_timeout.*$/discovery.zen.fd.ping_timeout: 30s/' /web/esuser/f57a16a2-0a6b-4bbe-b51e-0d42e3fb/9203/elasticsearch-5.1.2/elasticsearch-5.1.2/config/elasticsearch.yml
    
    #mkdir /var/redisplus;chown service.service  /var/redisplus
    
    #echo 'node.attr.hotwarm_type: warm' >> /web/esuser/c9fe4436-3cf3-413e-9a8e-6ef6bac4/9202/elasticsearch-7.3.2/elasticsearch-7.3.2/config/elasticsearch.yml
    
    
    # cd /var/data
    # wget http://midpackage-bjsm.oppoer.me/elasticsearch_exporter.tar.gz
    # chmod +x elasticsearch_exporter.tar.gz
    # tar zxf elasticsearch_exporter.tar.gz
    # mv elasticsearch_exporter-1.1.0.linux-amd64 elasticsearch_exporter
    
    # mkdir -p /var/data
    # cd /var/data
    # wget http://midpackage-bjsm.oppoer.me/elasticsearch_exporter.tar.gz
    # chmod +x elasticsearch_exporter.tar.gz
    # tar zxf elasticsearch_exporter.tar.gz
    # mv elasticsearch_exporter-1.1.0.linux-amd64 elasticsearch_exporter
    
    # host_ip=$(hostname -I | awk '{print $1}' | sed 's/[ 	]*$//g')
    # export_soc="$host_ip:9109"
    # es_soc="$host_ip:9202"
    # cd /var/data/elasticsearch_exporter
    # nohup /var/data/elasticsearch_exporter/elasticsearch_exporter --web.listen-address $export_soc --es.uri http://$es_soc >> /var/data/elasticsearch_exporter/nohup.log 2>&1 &    
    
    #Redis修改内核参数
    # echo "1" > /proc/sys/vm/overcommit_memory
    # echo never > /sys/kernel/mm/transparent_hugepage/enabled
    # echo never > /sys/kernel/mm/transparent_hugepage/defrag
    # centos_kernel=`uname -r | awk -F "." '{print $1$2}'`
    # if [ $centos_kernel == 26 ];then
    #     echo "kernel_veriosn:" $centos_kernel
    #     sysctl -w vm.swappiness=0
    #     cat /etc/sysctl.conf | grep 'vm.swappiness='
    #     if [ $? == "0" ];then
    #         sed -i 's/^vm.swappiness.*//g' /etc/sysctl.conf
    #         echo 'vm.swappiness=0' >> /etc/sysctl.conf
    #         sed -i '/^$/d' /etc/sysctl.conf
    #     else
    #         echo 'vm.swappiness=0' >> /etc/sysctl.conf
    #     fi
    # elif [ $centos_kernel == 310 ];then
    #     echo "kernel_veriosn:" $centos_kernel
    #     sysctl -w vm.swappiness=1
    #     cat /etc/sysctl.conf | grep vm.swappiness=
    #     if [ $? == "0" ];then
    #         sed -i 's/^vm.swappiness.*//g' /etc/sysctl.conf
    #         echo 'vm.swappiness=1' >> /etc/sysctl.conf
    #         sed -i '/^$/d' /etc/sysctl.conf
    #     else
    #         echo 'vm.swappiness=1' >> /etc/sysctl.conf
    #     fi
    # else
    #     echo "kernel_veriosn:" $centos_kernel
    #     exit 1
    # fi
    # over_memory=`cat /proc/sys/vm/overcommit_memory`
    # echo "overcommit_memory:" $over_memory
    # defrag=`cat /sys/kernel/mm/transparent_hugepage/defrag`
    # echo "defrag:" $defrag
    # cat /etc/sysctl.conf | grep 'vm.swappiness='
    
    
    # cd /home/service/app
    # wget http://midpackage-bjsm.oppoer.me/codis3.2.2.tgz
    # tar zxf codis3.2.2.tgz
    # chown -R service.service codis3.2.2
    
    # su - service -c 'sh /home/service/app/codis3.2.2/cluster_init_start.sh'
    # cd /home/service/app/codis3.2.2/config
    # ls redis_* | xargs rm
    # wget http://midpackage-bjsm.oppoer.me/codis3.2.2/config/redis_6400.conf
    # wget http://midpackage-bjsm.oppoer.me/codis3.2.2/config/redis_6500.conf
    # chown -R service.service /home/service/app/codis3.2.2
    
    # sed -i 's/15gb/20gb/g' /home/service/app/codis3.2.2/config/redis_6400.conf
    # sed -i 's/15gb/20gb/g' /home/service/app/codis3.2.2/config/redis_6500.conf
    
    # sed -i 's/codis-feeds/RecomendVideo-codis-bjht/g' dashboard.toml
    # sed -i 's/123456//g'  dashboard.toml 
    # sed -i 's/codis-feeds/RecomendVideo-codis-bjht/g' proxy.toml
    # ps -ef | grep codis | grep -v grep | awk '{print $2}' | xargs kill
    # cd /home/service/app/codis3.2.2/config
    # rm -rf /home/service/app/codis3.2.2/config/redis_6400.conf
    # rm -rf /home/service/app/codis3.2.2/config/redis_6500.conf
    # wget http://midpackage-bjsm.oppoer.me/codis3.2.2/config/redis_6400.conf
    # wget http://midpackage-bjsm.oppoer.me/codis3.2.2/config/redis_6500.conf
    # chown -R service.service /home/service/app/codis3.2.2
    # rm -rf /home/service/app/codis3.2.2/data/redis_6*
    # su - service -c 'sh /home/service/app/codis3.2.2/cluster_init_start.sh'
    
    # if [ ! -d /usr/local/paas-agent ]
    # then
    #   sudo mkdir -p /usr/local/paas-agent
    # fi
    # cd /usr/local/paas-agent
    # wget http://10.12.29.98:8090/tools/deploy-agent-prod2.sh -O deploy-agent-prod.sh
    # echo "wget ok"
    # sh deploy-agent-prod.sh 'http://10.12.29.98:8090/tools/' 
    
    # ps -ef | grep -E '(java|redis)' | grep -v paas | grep -v grep     
        
    # cd /web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/elasticsearch-5.1.2/plugins
    # wget http://midpackage-bjsm.oppoer.me/elasticsearch-prometheus-exporter-5.1.2.0.zip
    # unzip elasticsearch-prometheus-exporter-5.1.2.0.zip
    # mv elasticsearch elasticsearch-exporter
    # chown -R esuser.esuser elasticsearch-exporter
    # rm -rf elasticsearch-prometheus-exporter-5.1.2.0.zip
    
    # chmod +x /web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/op_bin/shutdown.sh
    # chmod +x /web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/op_bin/start.sh
    # su - esuser -c '/web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/op_bin/shutdown.sh'
    # sleep 2
    # su - esuser -c '/web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/op_bin/shutdown.sh'
    # sleep 1
    # su - esuser -c '/web/esuser/04515797-b09a-4f59-94c6-d3108aac/9200/elasticsearch-5.1.2/op_bin/start.sh'
    
    
    ##******************zookeepe*****************
    # locate zookeeper.out
    # if [ "$?" -ne "0" ];then
    #     wget http://midpackage-bjsm.oppoer.me/mlocate-0.22.2-6.el6.x86_64.rpm
    #     rpm -ivh mlocate-0.22.2-6.el6.x86_64.rpm
    #     updatedb
    # else
    #     exit 0
    # fi
    
    # snap_dir=`locate currentEpoch`
    # for snap_dir_2 in `echo $snap_dir`
    # do
    #     version_dir=`echo $snap_dir_2 | head -c -14`
    #     du -sh $version_dir | awk '{print $1}' | grep G
    #     if [ $? -eq "0" ];then
    #         cd $version_dir
    #         snap=`ls -lrt snapshot.* | tail -n 1 | awk '{print $NF}'`
    #         logfile=`ls -lrt log.* | tail -n 1 | awk '{print $NF}'`
    #         echo $snap
    #         echo $logfile
    #         ls snapshot.* | grep -v $snap | grep -v $logfile | grep -v acceptedEpoch | grep -v currentEpoch | xargs rm
    #         ls log.* | grep -v $snap | grep -v $logfile | grep -v acceptedEpoch | grep -v currentEpoch | xargs rm
    #     fi
    # done
    
    # zk_file=`locate zookeeper.out`
    # for i in `echo $zk_file`
    # do
    #     du -sh $i | awk '{print $1}' | grep G
    #     if [ "$?" == "0" ];then
    #         echo $i
    #         echo > $i
    #     fi
    # done
    
    ##********************************************
    
    # cd /web/esuser/12cb14f2-bb47-42cc-93c4-e3851354/9201/elasticsearch-6.5.4/elasticsearch-6.5.4/plugins
    # wget http://midpackage-bjsm.oppoer.me/prometheus-exporter-6.5.4.0.zip
    # unzip prometheus-exporter-6.5.4.0.zip -d prometheus-exporter
    # chown -R esuser.esuser prometheus-exporter
    # rm prometheus-exporter-6.5.4.0.zip
    
    # su - esuser -c 'sh /web/esuser/12cb14f2-bb47-42cc-93c4-e3851354/9201/elasticsearch-6.5.4/op_bin/shutdown.sh'
    # sleep 1
    # su - esuser -c 'sh /web/esuser/12cb14f2-bb47-42cc-93c4-e3851354/9201/elasticsearch-6.5.4/op_bin/start.sh'
    
    
    #grep "broker.id" /var/web/push/kafka_2.11-0.11.0.0/config/server.properties
    
    #ps -ef | grep -E  '(java|redis|mysql)' | grep -v grep  | grep -v grep 
  • 相关阅读:
    UML_04_时序图
    UML_03_类图
    UML_02_概述
    UML_00_资源帖
    UML_01_画图工具
    SpringCloud_00_资源帖
    Idea_03_常用快捷键
    Idea_02_常用配置
    Idea_01_安装与激活
    Codeforces命令行工具
  • 原文地址:https://www.cnblogs.com/lwhctv/p/12311155.html
Copyright © 2020-2023  润新知