再次整理备忘录(持续完善)
2023-12-01 10:00:00
Ubuntu 22.04 LTS
VirtualBox 安装 Ubuntu 支持共享文件夹
桥接网卡、静态IPv4、OpenSSH
sudo mount /dev/cdrom /media
sudo apt-get install bzip2 libxt6 libxmu6 gcc make perl
sudo ./VBoxLinuxAdditions.run
sudo adduser ubuntu vboxsf
sudo reboot
修改时区设置时间
timedatectl set-timezone 'Asia/Shanghai'
timedatectl set-time '2006-01-02 15:04:05'
timedatectl set-ntp false
timedatectl set-ntp true
Ubuntu 安装 Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Docker Compose 部署 NSQ
相较于官方配置修改如下
- 明确对外端口
- 挂载数据目录
- 指明广播地址
#filename: docker-compose.yml
version: '3'
services:
nsqlookupd:
image: nsqio/nsq
command: /nsqlookupd
ports:
- "4160:4160"
- "4161:4161"
nsqd:
image: nsqio/nsq
command: /nsqd --broadcast-address=${BROADCAST_ADDRESS} --lookupd-tcp-address=nsqlookupd:4160 --data-path=/data
depends_on:
- nsqlookupd
ports:
- "4150:4150"
- "4151:4151"
volumes:
- "/home/ubuntu/docker/nsq/data:/data"
nsqadmin:
image: nsqio/nsq
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
depends_on:
- nsqlookupd
ports:
- "4171:4171"
sudo BROADCAST_ADDRESS=192.168.1.1 docker compose up -d
sudo docker compose down
sudo docker compose stop
sudo docker compose start
sudo docker compose restart
sudo docker compose logs
sudo docker compose ps
MySQL 库表占用空间
SELECT TABLE_SCHEMA, SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA
SELECT TABLE_NAME, DATA_LENGTH/1024/1024, INDEX_LENGTH/1024/1024 FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'game'
Git 相关
git blame -L16,16 utils/stack.go
git config --global core.autocrlf true
Proxmox 制作U盘启动
- UltraISO 写入方式选择
RAW
- Rufus 注意选择
DD镜像
虚拟机硬盘扩容
- Proxmox
Hardware -> Hard Disk -> Resize disk
- VirtualBox
管理 -> 虚拟介质管理 -> 虚拟硬盘 -> 修改大小
,若生成过快照,则需要打开列表,选择明细
中显示分配到:虚拟机名称
且后面不带(快照名)
的{x...-...x}.vdi
sudo lsblk
sudo growpart /dev/sda 3
sudo lvresize --extents +100%FREE --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv
检测证书到期时间
echo | openssl s_client -connect www.zhipin.com:443 2>/dev/null | openssl x509 -noout -dates
#!/bin/bash
while IFS= read -r line
do
echo | openssl s_client -connect $line 2>/dev/null | openssl x509 -noout -checkend 2592000 1>/dev/null
if [ $? != 0 ]; then
echo $line will expire
fi
done < certs.txt