20240516_速成SQL

速成SQL(Base on Mysql) 一、Docker compose 快速拉起mysql 单机实例 1# 创建目录 2# mkdir -p ./.etc ./.data 3 4# 容器内mysqld.cnf 文件参数优化: 5# cat .etc/my.cnf 6[mysqld] 7character-set-server=utf8 8log-bin=mysql-bin 9server-id=1 10pid-file = /var/run/mysqld/mysqld.pid 11socket = /var/run/mysqld/mysqld.sock 12datadir = /var/lib/mysql 13sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 14symbolic-links=0 15secure_file_priv = 16wait_timeout=120 17interactive_timeout=120 18default-time_zone = '+8:00' 19skip-external-locking 20skip-name-resolve 21open_files_limit = 10240 22max_connections = 1000 23max_connect_errors = 6000 24table_open_cache = 800 25max_allowed_packet = 40m 26sort_buffer_size = 2M 27join_buffer_size = 1M 28thread_cache_size = 32 29query_cache_size = 64M 30transaction_isolation = READ-COMMITTED 31tmp_table_size = 128M 32max_heap_table_size = 128M 33log-bin = mysql-bin 34sync-binlog = 1……

阅读全文

20240420_getopts脚本模板

getopts脚本模板 使用shell 进行一系列的参数时可以修改该脚本来完成一系列复杂的操作 脚本模板: 1#!/bin/bash 2# ------------------------------------------ 3# Filename: getopts_template.sh 4# Version: 1.1 5# Date: 2024/04/20 6# Author: kid 7# Email: shuanglulee@foxmail.com 8# Website: shuanglu.life 9# Description: template for getopts 10# Copyright: 2024 kid 11# License: GPL 12# ------------------------------------------ 13# 定义帮助示例: 14do_help(){ 15 echo "用法: $0 [-a|--along] [-b|--blong 参数值] [-c参数值|--clong 参数值] 文件名" 16} 17 18echo……

阅读全文

20240416_Python手搓Http服务器

20240416_python手搓http服务器 最近看了有关阻塞、非阻塞、同步、异步、IO多路复用一些知识,所以想着手搓一个极简版本的Http服务器用来练手、以及巩固知识。 相关代码如下: 一、多线程版 1import random 2import socket 3import threading 4import time 5 6# 定义一个自定义的返回页面,通过读取当前文件夹下的index.h……

阅读全文

20240206_github大文件commit

关于在github上遇到上传的单个文件超过其限制的100MB时的处理 1. github 对于单个文件上传的大小是有限制的 详见:[About size limits on GitHub][https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github#about-size-limits-on-github] 其表现则体现为push过程当中的错误(我这里使用的是git的remote,而非http的remote) (如果是https的remote 可能有所不同。)……

阅读全文

20240110_golang排序

Golang排序 排序算法可以分为内部排序和外部排序。 其中:内部排序是指在内存中对数据进行排序,而外部排序是因为数据量较大,无法一次性放入内存,因此需要访问外部存储。 以下是十种常见的排序算法,具有不同的特点、时间复杂度和稳定性: 1. 冒泡排序(Bubble Sort): 通过多次比较和交换……

阅读全文

20230807_eci与swagent问题处置方式

20230807_eci与swagent问题处置方式 tag: skywalking-swck-mutating-webhook-configuration 一、问题现象 使用ECI作为弹性容器过程当中因为阿里云ECI容器会对部署的pod触发patch annotation操作如下: 而在此eci 控制器patch 之前 skywalking-swck-controller-manager 控制器会对namespace 带标签swck-injection=en……

阅读全文

20230727_velero备份迁移kubernetes集群

一、velero安装 1# wget https://github.com/vmware-tanzu/velero/releases/download/v1.11.1/velero-v1.11.1-linux-amd64.tar.gz 2# tar -zxvf velero-v1.11.1-linux-amd64.tar.gz 3# cp -av velero /usr/bin/ 4 5#velero -h 6# 启用命令补全 7# source <(velero completion bash) 8# velero completion bash > /etc/bash_completion.d/velero 1# cat > credentials-velero <<EOF 2[default] 3aws_access_key_id = admin 4aws_secret_access_key = P@ssw0rd 5EOF 6 7# velero install \ 8 --provider aws \ 9 --image velero/velero:v1.11.1 \ 10 --plugins velero/velero-plugin-for-aws:v1.6.0 \ 11 --bucket velero \ 12 --secret-file ./credentials-velero \ 13 --use-node-agent \ 14 --use-volume-snapshots=false \ 15 --namespace velero \ 16 --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://192.168.31.110:9000 \ 17 --wait 18 19 --prefix /cce-test 二、卸载 1kubectl delete namespace/velero clusterrolebinding/velero 2kubectl delete crds -l component=velero 三、执行velero 备份与恢复 1# 不执行存储pvc内容……

阅读全文

20230309_KuriseRollout灰度发布

一、架构设计: Kruise rollout 是一个Bypass的旁路组件, 其主要功能是为标准的Kubernetes Deployment、Statefuset以及 openKurise Cloneset这类工作负载进行提供高级部署功能而存在的,其中提供的高级部署功能包含: 金丝雀灰度、流量路由和渐进式交付。 其中关于原生的Kuber……

阅读全文

20230113_docker.sock构建镜像

一、systemd方式提供docker sock不足 节点需要额外安装 docker-ce 的服务组件,后期扩容node节点需要额外定制,相对麻烦 管理node进程状态麻烦,运行日志,进程挂掉等需要人为干预,升级也需要手动操作。 docker in pod 可以独立运行与管理自己的containerd 与docker 进程,与宿主机……

阅读全文