
more 注释之前的内容被视为文章摘要。
大约 1 分钟

more 注释之前的内容被视为文章摘要。
vim /etc/hosts
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
# 删除已有mysql
rpm -qa | grep mysql #查找是否存在已安装的mysql
yum remove mysql-community-common-x.x.xx-1.el7.x86_64 #如果找到,则依次卸载全部安装包
find / -name *mysql* #查找mysql的残余文件
rm -rf /usr/lib64/mysql #如果找到,则依次删除所有残余文件
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
# 基础配置
datadir=/data/datafile
socket=/var/lib/mysql/mysql.sock
log-error=/data/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
character_set_server=utf8
# 允许任意IP访问
bind-address = 0.0.0.0
# 支持大小写
lower_case_table_names=1
# 二进制配置
server-id = 1
log-bin = /data/log/mysql-bin.log
log-bin-index =/data/log/binlog.index
log_bin_trust_function_creators=1
expire_logs_days=7
# InnoDB存储数据字典、内部数据结构的缓冲池,16MB已经足够大了。
innodb_additional_mem_pool_size = 16M
# InnoDB用于缓存数据、索引、锁、插入缓冲、数据字典等,如果是专用的DB服务器,且以InnoDB引擎为主的场景,通常可设置物理内存的60%, 如果是非专用DB服务器,可以先尝试设置成内存的1/4
innodb_buffer_pool_size = 4G
# InnoDB的log buffer,通常设置为 64MB 就足够了
innodb_log_buffer_size = 64M
# InnoDB redo log大小,通常设置256MB 就足够了
innodb_log_file_size = 256M
# InnoDB redo log文件组,通常设置为 2 就足够了
innodb_log_files_in_group = 2
# 设置临时表空间最大4G
innodb_temp_data_file_path=ibtmp1:500M:autoextend:max:4096M
# 启用InnoDB的status file,便于管理员查看以及监控
innodb_status_file = 1
# 当设置为0,该模式速度最快,但不太安全,mysqld进程的崩溃会导致上一秒钟所有事务数据的丢失。
# 当设置为1,该模式是最安全的,但也是最慢的一种方式。在mysqld 服务崩溃或者服务器主机crash的情况下,binary log 只有可能丢失最多一个语句或者一个事务。
# 当设置为2,该模式速度较快,也比0安全,只有在操作系统崩溃或者系统断电的情况下,上一秒钟所有事务数据才可能丢失。
innodb_flush_log_at_trx_commit = 1
# 设置事务隔离级别为 READ-COMMITED,提高事务效率,通常都满足事务一致性要求
transaction_isolation = READ-COMMITTED
max_connections=600
max_connect_errors=1000
max_user_connections=400
# 设置临时表最大值,这是每次连接都会分配,不宜设置过大 max_heap_table_size 和 tmp_table_size 要设置一样大
max_heap_table_size = 100M
tmp_table_size = 100M
# 每个连接都会分配的一些排序、连接等缓冲,一般设置为 2MB 就足够了
sort_buffer_size = 2M
join_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M
# 建议关闭query cache,有些时候对性能反而是一种损害
query_cache_size = 0
# 如果是以InnoDB引擎为主的DB,专用于MyISAM引擎的 key_buffer_size 可以设置较小,8MB 已足够
# 如果是以MyISAM引擎为主,可设置较大,但不能超过4G
key_buffer_size = 8M
# 设置连接超时阀值,如果前端程序采用短连接,建议缩短这2个值,如果前端程序采用长连接,可直接注释掉这两个选项,是用默认配置(8小时)
interactive_timeout = 1200
wait_timeout = 120
# InnoDB使用后台线程处理数据页上读写I/0请求的数量,允许值的范围是1-64
innodb_read_io_threads=5
innodb_write_io_threads=3
# 设置慢查询阀值,单位为秒
long_query_time = 120
slow_query_log=1
# 日志输出会写表,也会写日志文件,为了便于程序去统计,所以最好写表
log_output=table,File
slow_query_log_file=/data/log/slow.log
# 针对log_queries_not_using_indexes开启后,记录慢sql的频次、每分钟记录的条数
log_throttle_queries_not_using_indexes = 5
# 作为从库时生效,从库复制中如何有慢sql也将被记录
log_slow_slave_statements = 1
# 检查未使用到索引的sql
log_queries_not_using_indexes = 1
# 快速预热缓冲池
innodb_buffer_pool_dump_at_shutdown=1
innodb_buffer_pool_load_at_startup=1
# 打印deadlock日志
innodb_print_all_deadlocks=1
大事务的特点是执行时间长,长期占有锁不释放,导致其他想操作同一行数据的线程阻塞,如果客户端设置了超时时间,超时后,客户端进行重试,又会申请一个mysql线程,然后再阻塞,最终会造成整个mysql库的线程枯竭,整个mysql库不可用,危害极大。
所以,对于开发人员来说,非常有必要知道如何查看长事务,如何终止掉大事务。
# https://download.docker.com/linux/static/stable/x86_64/
kubeadm init --pod-network-cidr=10.244.0.0/16
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
exit
kubectl get svc -n kube-system
kubectl get svc
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl get nodes
systemctl start kubectl
systemctl start kubelet
systemctl enable --now kubelet
kubectl get nodes
kubectl
kubectl get nodes
kubelet
kubectl get nodes
systemctl status kubelet
systemctl status kubectl
export KUBECONFIG=/etc/kubernetes/admin.conf
systemctl status kubectl
kubectl get nodes
ls
echo "export KUBECONFIG=/etc/kubernetes/admin.conf" >> ~/.bash_profile
source ~/.bash_profile
kubectl get nodes
kubectl get nodes -a
kubectl get pods
kubectl get pods --all-namespaces
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubectl get pods --all-namespaces
kubectl get nodes
kubectl get pods --all-namespaces
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
kubectl proxy
kubectl proxy --help
kubectl proxy --address=0.0.0.0 --port=8009
kubectl proxy --address=0.0.0.0 --port=8009 --accept-hosts='^*$'
openssl genrsa -out tls.key 2048
openssl req -sha256 -new -x509 -days-key tls.key -out tls.crt
kubectl proxy --address=0.0.0.0 --port=8009 --accept-hosts='^*$'
kubectl get svc -n kube-system
kubectl proxy --address=0.0.0.0 --port=8009 --accept-hosts='^*$'
docker images
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
kubectl get svc -n
kubectl get svc -n kubernetes-dashboard
kubectl proxy --address=0.0.0.0 --port=8009 --accept-hosts='^*$'
kubectl get pods --
history|grep pods
kubectl get pods --all-namespaces
kubectl -n kubernetes-dashboard edit svn kubernetes-dashboard
kubectl -n kubernetes-dashboard get svc
kubectl -n kube-system get svc
kubectl -n kubernetes-dashboard get svc
kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard
kubectl -n kubernetes-dashboard
kubectl -n kubernetes-dashboard get svc
kubectl create serviceaccount dashboard =n kubernetes-dashboard
kubectl create serviceaccount dashboard -n kubernetes-dashboard
kubectl create rolebinding def-ns-admin --clusterrole=admin --serviceaccount=default:def-ns-admin
kubectl create clusterrolebinding dashboard-cluster-admin -- clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard
kubectl create clusterrolebinding dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard:dashboard
kubectl describe sa dashboard -n kubernetes-dashboard
kubectl describe secret dashboard-token-vtncb -n kubernetes-dashboard
kubectl describe secret dashboard-token-4vqkm -n kubernetes-dashboard
kubectl get services nginx
kubectl get services test
kubectl -n default
kubectl -n default get svc
kubectl -n default edit svc test
kubectl -n default get svc
wget
wget node1:8000
wget node1:30000
docker ps
kubectl get ingress
kubectl get ingress -n kube-system
kubectl get ingress -n all-namespaces
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml
kubectl gett pods -n ingress-nginx
kubectl get pods -n ingress-nginx
kubectl get ingress
kubectl describe ingress nginx-web
kubectl get ingress nginx-web
kubectl get pods --all-namespaces|grep nginx
helm
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/aws/deploy.yaml
kubectl get pods --all-namespaces|grep nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/aws/deploy.yaml
kubectl get p
kubectl get pods -n ingress-nginx -o wide
kubectl delete namespaces ingress-nginx
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v0.44.0/deploy/static/provider/cloud/deploy.yaml
ls
vim deploy.yaml
kubectl apply -f deploy.yaml
kubectl get pods -n ingress-nginx -o wide
kubectl get pods -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx --watch
kubectl get ingress
kubectl get pods -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx --watch
kubectl get pods -n ingress-nginx -l
kubectl get pods -n ingress-nginx
kubectl get pods -n ingress-nginx -o wide
kubectl get namespace
kubectl get node
kubectl get pods
kubectl get pods -o wide
kubectl get deployment
kubectl get deployments
kubectl get pods -o wide
kubectl get service -o wide
kubectl get node
kubectl get nodes
kubectl get service -o wide
kubectl get nodes
kubectl get service -o wide
kubectl get pods -o wide
kubectl get service -o wide
kubectl get pods -o wide
kubectl get service -o wide
history|grep dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
kubectl get service -o wide
kubectl get pods -o wide
kubectl get pods --all-namespaces -o wide
kubectl get service --all-namespaces -o wide
kubectl get pods --all-namespaces -o wide
kubectl get pods -n kubernetes-dashboard -o wide
kubectl get service -n kubernetes-dashboard -o wide
kubectl get pods -n kubernetes-dashboard -o wide
kubectl get pods -n kubernetes-dashboard -o wide -w
kubectl get service -n kubernetes-dashboard -o wide
kubectl get pods -n kubernetes-dashboard -o wide -w
ls
wget https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/kubesphere-installer.yaml
kubectl apply -f kubesphere-installer.yaml
wget https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/cluster-configuration.yaml
ls
vim cluster-configuration.yaml
kubectl apply -f cluster-configuration.yaml
kubectl get svc --all-namespaces
docker pull kubesphere/ks-installer:v3.0.0
kubectl apply -f cluster-configuration.yaml
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
vim cluster-configuration.yaml
kubectl get svc/ks-console -n kubesphere-system
kubectl get svc -n kubesphere-system
kubectl apply -f cluster-configuration.yaml
kubectl get pod --all-namespaces
kubectl get svc --all-namespaces
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
kubectl get svc --all-namespaces
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
kubectl -v
kubectl -version
kubectl --version
kubectl
kubectl version
kubectl get node
yum install -y kubectl-1.18.6 kubelet-1.18.6 kubeadm-1.18.6
kubectl version
history|grep adm
kubeadm init --pod-network-cidr=10.244.0.0/16
kubeadm reset
kubeadm init --pod-network-cidr=10.244.0.0/16
history|grep apply
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
kubeadm get node
kubectl get node
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml
kubectl get svc --all-namespaces
kubectl get node --all-namespaces
kubectl get pod --all-namespaces