avatar
文章
155
标签
73
分类
16

Home
Archives
Link
About
Liarlee's Notebook
搜索
Home
Archives
Link
About
CheatSheet_Kubernetes
发表于2333-12-08|更新于2025-05-10|Kubernetes
移除所有失败的podkubectl delete pod --field-selector="status.phase==Failed" 查看证书信息查看 AWS LoadBalancer 证书的信息,检查证书的有效期: kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io aws-load-balancer-webhook -ojsonpath={.webhooks[0].clientConfig.caBundle} | base64 -d | openssl x509 -noout -text 使用 Debug 容器# 给特定的容器附加一个Sidecar, 并启动shell。 kubectl debug -it --image=public.ecr.aws/amazonlinux/amazonlinux:latest aws-node-cpmck # netshoot容器, 比较方便的用来进行网络部分的调试。 # 项目仓库地址: https://github.com/nicolaka/netshoot kubectl debug mypod -it --image=nicolaka/netshoot 查看EKS集群插件的兼容范围aws eks describe-addon-versions --kubernetes-version 1.25 --addon-name vpc-cni | grep addonVersion 列出节点上所有容器的镜像名称# ssh 到节点上面执行 nerdctl inspect $(nerdctl ps -a -q) | grep -i "image.:" | sort -f # 清理节点上未使用的镜像,不仅仅是 dangling image nerdctl image prune -af # 设置 nerdctl 命令的自动补全 nerdctl completion bash > /etc/bash_completion.d/nerdctl Nsenter 进入容器[[EKS_nsenter_into_container]] nerdctl inspect 02182f3e9137 | grep -i pid "Pid": 10306, nsenter -t 10306 -n 给系统加上一点点压力nerdctl run -ti --rm reg.liarlee.site/docker.io/polinux/stress-ng:latest --help nerdctl run -ti --rm reg.liarlee.site/docker.io/polinux/stress-ng:latest --cpu 1 强制删除 Podkubectl delete pod/applications-7c5f67d6bd-72jcf --force --grace-period=0 当然也可以删除什么其他的资源, 都可以, 实在不行就是 Finalizer 的影响, 需要删除 finalizer 了; 还有另一个问题是 pdb 可能会阻止一部分资源的删除, 也是需要查的. 转换docker compose文件为Kubernetes定义Source: https://kompose.io/installation/ curl -L https://github.com/kubernetes/kompose/releases/download/v1.35.0/kompose-linux-amd64 -o kompose kompose convert --controller statefulset
CheatSheet_Linux
发表于2333-12-08|更新于2025-05-10|Linux
显示文件中所有未注释的行grep -v "#" /usr/local/nginx/conf/nginx.conf |grep -v "^$" 公网IP地址质量测试IP质量体检报告 https://github.com/xykt/IPQuality 双栈 bash <(curl -sL IP.Check.Place) v4 bash <(curl -Ls IP.Check.Place) -4 查看时间范围内的 atop 记录atop -r /var/log/atop_20240704 -b 03:53 -e 03:59 查找 Grafana 日志中remote_addr字段出现次数awk '{ match($0, /remote_addr=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/, ip); if(ip[1]) print ip[1] }' grafana.log | sort | uniq -c 使用 Ssh-keygen 从 Pem 文件中导出公钥ssh-keygen -y -f awesome.pem > public.pub Rsync 命令传输数据保留文件的原本的信息, 归档模式, 传输前压缩, 以及展示进度 和 暂存发送文件进度. rsync -azP /source/path/ /destination/path/ rsync -aP /source/path/ /destination/path/ 查看磁盘设备的详细信息包括 EBS Volume ID 和 设备驱动类型 lsblk -f -o +SERIAL,SCHED,TRAN,STATE 强制退出程序并生成 Corefile组合键用于发送 SIGQUIT 信号,用于终止正在运行的进程。与Ctrl+C不同的是,Ctrl+\会生成一个core文件,用于调试程序。同时在某些特定的场景下, 这个指令并Ctrl+c停止进程的速度快。 Ctrl+\ 查看当前系统中 CPU 使用率最高的前 20 个进程ps auxwww --sort -%cpu | head -20 列出当前系统中内存使用最高的前 20 个进程ps auxwww --sort -rss | head -20 列出系统中所有进程的详细信息ps auxf --width=200 以完整格式列出系统中所有进程的详细信息ps auxwwwf Curl 输出各个阶段所花费的时间Network_tc控制流量-update curl -s -w "time_namelookup:%{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_redirect: %{time_redirect}\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" -o /dev/null $HTTP_URL 对于命令输出内容的解释: curl -o /dev/null \ # 将下载的文件输出到 /dev/null (即丢弃) -s \ # 静默模式,不显示进度条等信息 -w "time_namelookup:%{time_namelookup}\n \ # 输出 DNS 解析时间 time_connect: %{time_connect}\n \ # 输出建立 TCP 连接所花费的时间 time_appconnect: %{time_appconnect}\n \ # 输出建立 SSL/TLS 连接所花费的时间 time_redirect: %{time_redirect}\n \ # 输出重定向所花费的时间 time_pretransfer: %{time_pretransfer}\n \ # 输出从开始到准备好传输所花费的时间 time_starttransfer: %{time_starttransfer}\n \ # 输出从开始到第一个字节被传输所花费的时间 time_total: %{time_total}\n" \ # 输出整个传输所花费的总时间 $HTTP_URL # 要下载的文件 URL 查看与 TCP 内存管理和拥塞控制相关的内核参数通常这些配置会出现在 [[Linux_Sysctl 参数记录]] /etc/sysctl.conf 文件中。 sysctl -a | egrep "rmem|wmem|tcp_mem|adv_win|moderate|slow_start" 列出系统中所有用户的 Crontab 任务cat /etc/passwd | cut -f 1 -d : | xargs -I {} crontab -l -u {} 查看 AWS EC2 的 Billing CodeRedhat / SUSE 的 Enterprise 版本在 AWS EC2 上面运行实例会带有 Billing Code 的, 这标记 OS 是否是付过费用的,会不会收到安全补丁, 不会使用系统内的订阅管理器。Finding AMI billing and usage detailsAMI billing information fields # IDMSv1 curl http://169.254.169.254/latest/dynamic/instance-identity/document # IDMSv2 TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/dynamic/instance-identity/document 查看 SUSE 的注册情况,以及是否启用 LTSSsudo SUSEConnect --list-extensions 查看网络可能存在的丢包和异常ip 命令查看链路层丢包指标. ip -s link show ens18 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether bc:24:11:6f:db:1c brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped missed mcast 29865128113 35188796 0 4316 0 0 TX: bytes packets errors dropped carrier collsns 6054383278 2278239 0 0 0 0 altname enp0s18 ethtool 命令查看网卡硬件队列的丢包 ethtool -S eth0 | grep drop 查看 由于 UDP Buffer 造成的丢包 nstat -az UdpSndbufErrors UdpRcvbufErrors #kernel UdpRcvbufErrors 0 0.0 UdpSndbufErrors 0 0.0 OpenSSL 测试指定域名并输出调试信息openssl s_client -debug --connect $URL:443 指定算法和协议版本 openssl s_client -debug --connect $URL:443 -tls1_2 -cipher RC4 查看证书的有效期: echo | openssl s_client -servername $URL:443 -connect $URL:443 2>/dev/null | openssl x509 -noout -dates 查看启动以来的内核日志journalctl -xeak 查看特定级别的日志journalctl -xeak -p3 # 日志级别的补充说明: # FROM..TO. The log levels are the usual syslog log levels as documented in syslog(3), i.e. "emerg" (0), "alert" (1), "crit" (2), "err" (3), "warning" (4), "notice" (5), "info" (6), "debug" (7). If a # single log level is specified, all messages with this log level or a lower (hence more important) log level are shown. If a range is specified, all messages within the range are shown, including both # the start and the end value of the range. This will add "PRIORITY=" matches for the specified priorities. journald记录的所有启动会话(boots)信息journalctl --list-boots # 输出所有重启的历史记录 # 命令会通过序号的方式标记重启的记录, 0, -1, -2, -3 等等 查看上次系统启动的日志journalctl -xeab -1 查看所有日志不使用pager进行分页journalctl -xea --no-pager 查看特定 Service 日志journalctl -xeau SERVICE_NAME 查看并追踪特定 Service 日志journalctl -xeafu SERVICE_NAME 查看最近 100 行journalctl -n 100 --no-pager -xeau SERVICE_NAME 查看指定时间范围的日志journalctl -xea --no-pager -S "2024-01-31 18:20:00" -U "2024-01-31 18:40:00" # 显示从什么时间开始的日志 或者 到什么时间为止的日志。 # Format: 2012-10-30 18:17:16 # 可以仅仅提供日期字段, 时间会默认全0 # -S, --s ...
CheatSheet_awscli
发表于2333-12-08|更新于2025-05-10|AWS
查看实例和对应实例的系统平台信息aws ec2 describe-instances --query "Reservations[*].Instances[*].{InstanceId:InstanceId,PlatformDetails:Platform}" --output table 查看实例和EBS的关联关系aws ec2 describe-volumes --query 'Volumes[*].[VolumeId, Attachments[0].InstanceId, Size]' --output table
CheatSheet_Databases
发表于2333-12-08|更新于2025-05-10|Database
统计 MySQL 数据库占用的空间mysql Ver 8.4.1 for Linux on x86_64 (MySQL Community Server - GPL) mysql> select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size, concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size from information_schema.tables group by TABLE_SCHEMA ORDER BY data_size desc; +--------------------+-----------+------------+ | TABLE_SCHEMA | data_size | index_size | +--------------------+-----------+------------+ | mysql | 7.51 MB | 0.34MB | | test_db | 230.31 MB | 30.31MB | | sys | 0.01 MB | 0.00MB | | information_schema | 0.00 MB | 0.00MB | | performance_schema | 0.00 MB | 0.00MB | +--------------------+-----------+------------+ 5 rows in set (0.17 sec) 查看 MYSQL 的版本mysql> status; -------------- mysql Ver 8.4.1 for Linux on x86_64 (MySQL Community Server - GPL) Connection id: 26 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.4.1 MySQL Community Server - GPL Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 19 hours 36 min 40 sec Threads: 3 Questions: 661 Slow queries: 4 Opens: 737 Flush tables: 3 Open tables: 150 Queries per second avg: 0.009 -------------- 启用 MYSQL 慢日志官方文档: https://dev.mysql.com/doc/refman/8.4/en/slow-query-log.html [mysqld] slow_query_log=ON long_query_time=10 查看当前运行中的慢日志设置 mysql> show variables like 'slow_query%'; +---------------------+--------------------------------------+ | Variable_name | Value | +---------------------+--------------------------------------+ | slow_query_log | OFF | | slow_query_log_file | /var/lib/mysql/mysql-master-slow.log | +---------------------+--------------------------------------+ 2 rows in set (0.01 sec) mysql> show variables like 'long_query_time'; +-----------------+-----------+ | Variable_name | Value | +-----------------+-----------+ | long_query_time | 10.000000 | +-----------------+-----------+ 1 row in set (0.01 sec) 基于Mysql的文档记录: To include slow administrative statements in the slow query log, enable the log_slow_admin_statements system variable. Administrative statements include ALTER TABLE, ANALYZE TABLE, CHECK TABLE, CREATE INDEX, DROP INDEX, OPTIMIZE TABLE, and REPAIR TABLE. 查看 Binlog 的内容mysql> show binlog events in 'binlog.000005'; ```r
Fortio 笔记
发表于2025-05-09|更新于2025-05-10|Kubernetes
Fortio 官方网站Fortio Github Repo Thanks ~ https://skyao.io/learning-fortio/docs/introduction/fortio.html Fortio 是一个快速、小型(4Mb docker 镜像,最小依赖项)、可重复使用、可嵌入的 go 库以及命令行工具和服务器进程,服务器包括一个简单的 Web UI 和 REST API 来触发运行并查看结果的图形表示(单个延迟图和多个结果比较最小值、最大值、平均值、qps 和百分位数图)。 我比较感兴趣的是两个工具一个是 Fortio 本身, 可以支持 tcp 和 udp 的负载测试并且生成好观察的图表。还有一个是 DNSping, 通过命令发送 dns 请求并记录 dns 响应的延迟情况。 dnsping通过这样的工具可以非常轻松的看到在集群内的 pod 解析 dns 请求成功与否以及延迟情况, 例如: kubectl debug -n monitoring --profile=general grafana-694b5f9796-nqkhn -it --image=fortio/dnsping -- dnsping -c 10 glance.liarlee.site. 192.168.31.3 # 或者是 kubectl debug -n monitoring --profile=general grafana-694b5f9796-nqkhn -it --image=fortio/dnsping -- dnsping -c 10 glance.liarlee.site. kube-dns.kube-system 输出的结果中, 包括了延迟, 和完整的 DNS 应答: Defaulting debug container name to debugger-dcdhz. If you don't see a command prompt, try pressing enter. 15:26:04.782 0.3 ms 2: [glance.liarlee.site. 3 IN A 192.168.31.50] 15:26:05.783 0.3 ms 3: [glance.liarlee.site. 2 IN A 192.168.31.50] 15:26:06.783 0.4 ms 4: [glance.liarlee.site. 1 IN A 192.168.31.50] 15:26:07.783 1.7 ms 5: [glance.liarlee.site. 30 IN A 192.168.31.50] 15:26:08.782 0.3 ms 6: [glance.liarlee.site. 30 IN A 192.168.31.50] 15:26:09.783 0.4 ms 7: [glance.liarlee.site. 29 IN A 192.168.31.50] 15:26:10.782 0.3 ms 8: [glance.liarlee.site. 28 IN A 192.168.31.50] 15:26:11.783 0.5 ms 9: [glance.liarlee.site. 27 IN A 192.168.31.50] 15:26:12.782 0.3 ms 10: [glance.liarlee.site. 26 IN A 192.168.31.50] 0 errors (0.00%), 10 success. response time (in ms) : count 10 avg 0.4705533 +/- 0.4 min 0.25093400000000005 max 1.651941 sum 4.705533 # range, mid point, percentile, count >= 0.250934 <= 0.3 , 0.275467 , 30.00, 3 > 0.3 <= 0.4 , 0.35 , 70.00, 4 > 0.4 <= 0.5 , 0.45 , 90.00, 2 > 1.6 <= 1.65194 , 1.62597 , 100.00, 1 # target 50% 0.35 # target 90% 0.5 # target 99% 1.64675 fortio在他提供的文档中有如下的说明, 我认为描述了这个命令使用中最初的疑问, 我应该怎么传递或者设置flag来获得最佳的测试结果?https://github.com/fortio/fortio/wiki/FAQ#i-want-to-get-the-best-results-what-flags-should-i-pass 我在自己的一个小主机上面运行了单master 双node 的 kubernetes 集群, 并在上面运行了 VaultWarden 来维护我的密码。 ( 是 Sidecar 模式的 istio 进行流量管理的,sidecar 怎么都会导致延迟的增加, 这个是无法避免的。对 VaultWarden LoginPage 测试一下, 看当前的环境中能服务能承载的压力是什么样子的? 我设置的测试是 2000 qps 10 threads 的测试, 最后的结果是 1085 qps,着应该是达到了当前这个服务的上限, 尝试扩展了一下ingress pod 的数量, 查看 延迟中位数据 没有非常大的变化, 但是长尾的请求变的更长了(笑 这个工具还是做的很直观的, 可以说是一个 istio 版本的 ab 命令 , 并且带图~ 如果把 fortio server 启动在 pod 里面, 看来也可以做集群内的 负载测试, 这个工具最大的价值就是可以提供稳定压力的负载, 并且可以测试多种不同的协议。
TrueNAS Core 自动更新UI证书
发表于2024-11-15|更新于2025-05-10|Application
这两天提示 TrueNAS Core UI 的证书过期了, 看了一下, 默认是一年的证书, 需要更新了。 使用 certbot 自动更新证书的方式比较干净,原始文档在这里 . 比其他的方法要好, 其中记录的步骤不太细致或者已经过时了, 记录一下我的步骤。 Go 创建一个Jail, 名称是 certbot, 具体的Release选择哪个都可以。本身这个证书只是给UI使用, 所以也就不需要创建任何的 Dataset 挂载进去。 在 TrueNAS Core 创建一个新的 API Key, 用来给脚本部署证书使用。 在 Cloudflare 创建一个新的 API Key 用来作为 dns challenges 的入口, 调用 cloudflare 的接口。 通过 UI 登录到 Jail 里面执行初始化。# Install prerequisites pkg update pkg install python311 py311-certbot py311-certbot-dns-cloudflare git # There have some different name in my truenas core 13, update this command. # Use pkg search certbot you can check the latest version. # Install the deploy script git clone https://github.com/danb35/deploy-freenas.git /opt/deploy-freenas cp /opt/deploy-freenas/deploy_config.example /opt/deploy-freenas/deploy_config # Now configure the deploy script by editing /opt/deploy-freenas/deploy_config # Add some detail. pkg install vim # Edit it. vim /opt/deploy-freenas/deploy_config # 这里面的 私钥 和 fullchain 证书的位置, 与脚本提供的默认位置已经不同了,需要在配置文件里面指定一下。 # 如果还没生成证书可以暂时不配置, certbot 命令运行完成后回来填。 # Please note that you need to replace all [...] with your values. # Line-Number CONFIG field 7 api_key = [YOUR TRUENAS CORE API KEY create at step 2] 14 cert_fqdn = [YOUR TRUENAS CORE FQDN FOR CERT CSR] 28 privkey_path = [/usr/local/etc/letsencrypt/live/[FQDN]/privkey.pem] 33 fullchain_path = [/usr/local/etc/letsencrypt/live/[FQDN]/fullchain.pem] # Configure Cloudflare credentials cat /usr/local/etc/certbot_cloudflare.conf dns_cloudflare_email = [Cloudflare email address here] dns_cloudflare_api_key = [API key from Cloudflare here] chown root:wheel /usr/local/etc/certbot_cloudflare.conf chmod 600 /usr/local/etc/certbot_cloudflare.conf # Run certbot to get the certificates for the first time (fill in the domain and email address) # 在运行这个命令结束之后, 会提供正确的保存位置, 将这个路径填到 /opt/deploy-freenas/deploy_config 这个配置文件中。 certbot certonly -d ["*.example.com"] -m ["your.email@example.com"] --dns-cloudflare --dns-cloudflare-credentials /usr/local/etc/certbot_cloudflare.conf --preferred-challenges dns-01 # Ensure the deploy script can successfully deploy the certificate to TrueNAS Core # 在这里需要指定一下写好的配置文件, 理论上应该是直接运行命令可以识别到, 为了保险和后续的稳定执行, 在命令行加参数指定。 /opt/deploy-freenas/deploy_freenas.py -c /opt/deploy-freenas/deploy_config # Create a cron job cat <<- EOF >> /etc/crontab # Renew Let's Encrypt certificates 0 0,12 * * * root certbot renew --deploy-hook /opt/deploy-freenas/deploy_freenas.py EOF 查看当前的证书是否已经部署成功。
B+树笔记
发表于2024-09-20|更新于2025-05-10|Database
Start下面的两个非常通俗的解释了 B tree 的定义, 以及btree 是如何完成数据插入以及查找的, 不同的程序会使用不同结构的 btree 变体, 是在通常的Btree 逻辑框架上面添加更多的限制条件和规定。 Understanding B-Trees: The Data Structure Behind Modern Databaseshttps://www.youtube.com/watch?v=K1a2Bk8NrYQ&t=42s B-trees and database indexeshttps://planetscale.com/blog/btrees-and-database-indexes#how-mysql-uses-b-trees
Kubernetes NFS CSI 启动 bitnami postgres 镜像权限不足
发表于2024-09-08|更新于2025-05-10|Kubernetes
开始准备在kubernetes 集群里面部署一个 pgsql, 存储一些自己的个人数据,postgres pod 启动不了,pod 会反复 CrashLoopback, 查看其中postgres 进程的容器, 会遇到这样的报错: fixing permissions on existing directory /var/lib/postgresql/data … ok creating subdirectories … ok selecting dynamic shared memory implementation … posix selecting default max_connections … 20 selecting default shared_buffers … 400kB selecting default time zone … Etc/UTC creating configuration files … ok running bootstrap script … 2020-07-28 19:47:30.936 UTC [73] FATAL: data directory “/var/lib/postgresql/data” has wrong ownership 2020-07-28 19:47:30.936 UTC [73] HINT: The server must be started by the user that owns the data directory. child process exited with exit code 1 initdb: removing contents of data directory “/var/lib/postgresql/data” 这看上去就是目录权限不正确 … 我看了好几遍 bitnami 的文档, 都是基础的错误排除. 两个建议: 检查权限。 使用 VolumePermission 设置 initcontainer 初始化容器权限。 使用 VolumePermission 初始化目录权限Bitnami 的这个提供 helm 参数, 可以方便的设置 initcontainer 来进行 pv 的权限设置. 于是为了偷懒, 就 set 了这个参数.尝试使用 VolumePermission 的容器来进行 Volume path 权限的初始化, 但是 initcontainer 也启动不了, 报错: chown: changing ownership of '/bitnami/postgresql': Invalid argument 这initcontainer的报错就离谱了, 这命令怎么会有无效参数。 检查权限在另一个机器上面 pull docker 镜像, 启动容器进去看用户, 没问题 uid 1001/gid 0, 是一个非常合理的设置。然后检查目录权限, 也符合要求。docker 可以启动这个 image, 那么这个问题应该是出现在 Kubernetes 和 NFS 的配合上面。talos 创建的集群, 用了 TrueNAS 提供的 NFS 服务, 并在集群里面安装了 CSI 驱动: https://github.com/kubernetes-csi/csi-driver-nfs按照这个配置检查了一边, 没发现问题, 启动测试的 pod 也可以正常挂载和写入。 驱动本身也没有报错的日志. 算了还是在 pod 里面直接进去看看吧。尝试修改statefulset强制指定容器主进程命令: 加上 command 和 args , 使用 sleep infinity. 进入检查目录权限的时候发现这个目录的uid和gid的映射关系有问题, 长这样: drwxr-xr-x 2 4294967294 4294967294 24 2024-09-08 11:50 data 然后继续搜索, 发现这些奇怪的资料: https://www.truenas.com/community/threads/nobody-4294967294-and-nfsv4.99352/ https://www.suse.com/support/kb/doc/?id=000017244 看完我的理解是, NFSv4 会尝试解析并在域内进行 idmapping, 如果 mapping 不到, 会将 pod 中进程使用的 uid 和 gid 转换成了 nobody, 在 TrueNAS 上面我的测试是我已经设置了正确的权限, mapalluser 给了 uid 1001. 但是这个并不好用.我不理解, 一直到我看到了: https://www.truenas.com/community/threads/issue-with-user-mapping-when-mounting-nfs-share-on-ubuntu-18-04.79451/ What you’ve called “permissions” are actually the user and group ids of any file/directory you’ve listed on your new Ubuntu server. If you’re only seeing numeric values for uid & gid in “ls” output on your Ubuntu server, it simply means there’s no user on the Ubuntu server with a uid/gid of 1001/1001. The output of getent group and getent passwd would confirm that. What non-root users have you added to your new Ubuntu server?P.S. The reason why unchecking the “NFSv3 ownership model for NFSv4” causes the permissions to read “nobody:4294967294” is explained here: https://mwl.io/archives/796So unless you plan to start using NFSv4 with kerboros, I’d stick to using NFSv4 with the NFsv3 ownership model. 将 v4 版本的权限模型, 切换回 v3 之后, 全好了。 如果有折腾这个的, 这可能是一个比较奇葩的问题, 在这几个东西互相配合的时候会出错.
TigerVNC 在 RHEL9 的安装和配置
发表于2024-08-21|更新于2025-05-10|Linux
安装 VNC 步骤记录初始化系统, 安装图形化. ( 我还安装的 虚拟化宿主机, 我需要所以就安装了. # 更新系统软件包到最新 sudo dnf update -y # 查看哪些可用的 Group, (方便 sudo dnf grouplist # 安装 Server GUI sudo dnf groupinstall -y "Server with GUI" # 安装 KVM (按需 sudo dnf groupinstall -y "Virtualization Host" # 安装 TigerVNC 服务 sudo dnf install -y tigervnc-server # 关闭 SElinux sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config # 可以重启 或者 设置为 Permissive sudo setenforce 0 # 关闭防火墙. sudo systemctl stop firewalld # 关闭防火墙开机启动, 当然可以使用 firewall-cmd 管理防火墙条目, 放行端口即可. sudo systemctl disable --now firewalld 配置 VNC config # 复制 VNC 服务, 创建 1 号位服务. sudo cp -prv /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver\@:1.service 分配 :1 图形化接口给 ec2-user , 也可以分配给其他用户. vim /etc/tigervnc/vncserver.users :1=ec2-user 配置共享session, 没有安全性的设置. vim /etc/tigervnc/vncserver-config-defaults alwaysshared 切换到普通用户初始化su - ec2-user # 设置密码 vncpasswd 设置分辨率 vim ~/.vnc/config geometry=1920x1080 开机启动 sudo systemctl enable vncserver@:1.service sudo systemctl daemon-reload && sudo systemctl restart vncserver@:1 排查方法# 查看 service 状态 sudo systemctl status vncserver@:1 # 查看日志 sudo journalctl -xefu vncserver@:1 # 查看 vncserver 日志 # 这个日志是需要到对应用户的家目录下查看的, 哪个用户创建的 vnc 会话, 就去哪个用户的家目录下看. # 一般的日志格式是 [HOSTNAME]:1.log cat ~/.vnc/*.log
MySQL 计算内存用量
发表于2024-07-31|更新于2025-05-10|Database
对于 MySQL,可以按以下示例计算 RDS for MySQL 数据库实例的大致内存使用量:Maximum MySQL Memory Usage = innodb_buffer_pool_size + key_buffer_size + ((read_buffer_size + read_rnd_buffer_size + sort_buffer_size + join_buffer_size) * max_connections) From repost: https://repost.aws/zh-Hans/knowledge-center/low-freeable-memory-rds-mysql-mariadb From MySQL Offical:5.7 https://dev.mysql.com/doc/refman/5.7/en/memory-use.html8.0 https://dev.mysql.com/doc/refman/8.0/en/memory-use.html 存储引擎的说明:https://dev.mysql.com/doc/refman/8.0/en/innodb-in-memory-structures.html
12…16
avatar
Liarlee
Archlinux User, Support Engineer
文章
155
标签
73
分类
16
Follow Me
公告
都道无人愁似我,今夜雪,有梅花,似我愁。
最新文章
CheatSheet_Kubernetes2333-12-08
CheatSheet_Linux2333-12-08
CheatSheet_awscli2333-12-08
CheatSheet_Databases2333-12-08
Fortio 笔记2025-05-09
TrueNAS Core 自动更新UI证书2024-11-15
分类
  • AWS2
  • Application5
  • Books5
  • Database8
  • Docker6
  • EKS5
  • ESXi1
  • ElasticSearch2
标签
TrueNasCore btrfs Repo Android ElasticSearch Git Redis KVM LogAgent Headscale MongoDB Cilium Orthanc Prometheus Ranger VPC FileSystem JAVA Network Steam NAS RPM Memory Ceph Fedora Filesystem Nvidia GRUB2 Strace AWS CPU Firefox 诗 EBS Ansible Python RIME SElinux Database Hexo
归档
  • 十二月 23334
  • 五月 20251
  • 十一月 20241
  • 九月 20242
  • 八月 20241
  • 七月 20243
  • 六月 20242
  • 五月 20244
网站资讯
文章数目 :
155
本站总字数 :
183k
本站访客数 :
本站总访问量 :
最后更新时间 :
©2020 - 2025 By Liarlee
框架 Hexo|主题 Butterfly
搜索
数据库加载中