Switch language
zh
Switch theme
Light
  • mysql 220k 数据行时, count() 很慢, 要2s多

    问 deepseek “mysql innodb 20万行, 使用 select count(*) from tablea; 耗时2s, 正常吗” 答: mysql innodb 的查询行数是全表扫描, 而 myisam 是直接存储了数量, 可通过加大 innodb_buffer_pool_size 的值来加速, innodb_buffer_pool_size 一般默认为 128M, 现在 改为 4G, 速度变成了 0.2s 查询当前 mysql 的 innodb_buffer_pool_size 值 sql: SHOW VARIABLES LIKE 'innodb_buffer_pool_size'; my.ini(windows) 或 my.cnf(linux) 的 [mysqld] 下 修改 my.ini(my.cnf) 配置文件修改(重启后生效) [mysqld] innodb_buffer_pool_size = 4G 临时修改(重启后失效) SET GLOBAL innodb_buffer_pool_size = 4294967296; # 4G 如果是在 docker compose 中改了配置文件, 需要重新 build image # 在 docker-compose.
  • gofrp (内网穿透) 的安装和使用

    文档地址 使用 gogrp 通过自定义域名访问内网的 Web 服务 1. 安装 分别在 client 和 server 下载便携版的可执行文件, 如 client 是 windows 系统, 则下载后的文件为 frpc.exe, frpc.toml, frps.exe, frps.toml, LICENSE, client 端只需要 frpc.exe 及 frpc.toml 即可 如 server 是 linux 系统, 则下载后的文件只需要 frps 及 frps.toml 2. 配置 # frps.toml 配置 bindPort = 7000 vhostHTTPPort = 8600 # 要设置 vhostHTTPPORT, 最后通过服务端的 ip:vhost端口 进行访问 # frpc.toml 配置 serverAddr = "xx.xx.xx.xx" serverPort = 7000 [[proxies]] name = "test-web" type = "http" localIP = "127.
  • vmware-共享文件夹设置

    虚拟机关机状态下, vmware中 设置-选项-共享文件夹 添加要共享的文件夹 虚拟机开机, vmware中 虚拟机-安装VMware-Tools 虚拟机中安装 open-vm-tools-desktop (has gui) 或 open-vm-tools (no gui) 虚拟机中执行 /usr/bin/vmhgfs-fuse .host:/ /home/user1/shares -o subtype=vmhgfs-fuse,allow_other 挂载共享文件夹, ubuntu 提示 allow_user 需要其它设置, 则删除 ‘,allow_other’ 即可 open-vm-tools 安装参考官方文档 文件夹挂载 参考文档 参考csdn: vmware 挂载共享文件夹
  • Linux Crontab Pwd

    背景: 使用 crontab -e 添加定时任务后, 发现任务没有如希望的执行, 发现要执行的命令是使用了相对路径引入文件, 推测是文件路径不正常 在 linux 中 root 用户执行命令 crotab -e 添加任务获取当前工作目录 * * * * * pwd >> ~/tmp.txt 2>&1 之后生成一新用户 # root 用户 # -m 生成用户同名 home 目录 useradd -m test passwd test # test 用户 同样新增获取 pwd 输出到其 home 目录的任务 crontab -e 经过执行发现, 在 /root/tmp.txt 文件中 pwd 输出为 /root 在 /home/test/tmp.txt 文件中 pwd 输出为 /home/test “The cron daemon starts a subshell from your HOME directory” 参考文档
  • 查看本机-ip

    hostname -I ip addr ifconfig, // 需要已安装 net-tools
  • virtualbox-centos7-7-nat-网络连接-并使用-ssh-连接

    virtual 添加 nat 网络 虚拟机配置 nat 网络 centos 系统文件修改 cd /etc/sysconfig/network-scripts/ // 查找 ifcfg-enp... 文件并修改其中的 onboot 为 yes vi ifcfg-en0s3 // 修改后, 重启 network 服务, 并用 ping 或 curl 进行测试 service network restart ping www.baidu.com 虚拟机设置 xshell 连接 ssh -p root@127.0.0.1 2222 或 文件-新建-连接….
  • ubuntu-没有root默认密码--

    环境: vmware简易安装 ubuntu 版本 18.04 安装完成后 root 用户没有密码, 但是中途让添加过一个用户, 这个用户即有 sudo 权限 # 使用 `sudo passwd` 设置 root 的密码 # 使用 `su` 切换到 root 用户 How to Find/Change Ubuntu Default Root Password
  • linux-ssh-端口更改-及-ip-限制-&-rsa-登录

    原文见 cnblog: 修改linux的ssh默认端口号22的方法 rsa 参考 一、修改配置文件 vi /etc/ssh/sshd_config 找到#Port 22 修改为自己要使用的端口号:Port 26000 然后 :x 退出保存 二、重启ssh服务 /etc/init.d./sshd restart 如果还要设置防火墙,配置:vi /etc/sysconfig/iptables 启用26000端口:/etc/init.d/iptables restart 三、如果要显示固定IP才能登陆: 1.修改 /etc/hosts.deny, 加入一行sshd:ALL –#意思是任何ip都不能登陆 2.然后修改:/etc/hosts.allow,在其中进行如下设置:sshd:192.168.0.241:allow –#意思是只允许192.168.0.241登陆 四、rsa 密钥对登录 client 执行以下命令生成密钥对 (~/.ssh) ssh-keygen -t rsa 把 is_rsa.pub 复制到服务器的 ~/.ssh/authorized_keys 文件后面 配置 /etc/ssh/sshd_config RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys service sshd restart 20241220 新增 上述是 centos 更改 ssh 端口, 不适用 ubuntu 2204 以后的版本, ubuntu 最新版本 配置ssh端口如下 参考自 csdn: 【解决】Ubuntu SSH Server 修改默认端口无效
  • acme-sh-自动申请-ssl-证书

    /root/.acme.sh/acme.sh --install-cert --nginx /usr/local/nginx/conf/vhost/my.domain.conf -d my.domain.com \ --key-file /usr/local/nginx/ssl/my.domain.com/key.pem \ --fullchain-file /usr/local/nginx/ssl/my.domain.com/cert.pem \ --reloadcmd "supervisorctl restart nginx" 上面的 –nginx 指定配置文件路径 参考: https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E 1. 生成证书, 检测域名所有权 acme.sh --issue -d www.aaa.com --webroot /www/wwwroot/www.aaa.com #或 acme.sh --issue -d www.aaa.com --nginx /usr/local/nginx/conf/sites-enabled/www.aaa.com.conf # 注意: 在 issue 阶段不要在 conf 中设置 listen 443 及 ssl 相关配置, 否则在没有正确的 cert&key 文件时会有报错 # 应在 issue 执行后, 再在 conf 文件中添加 ssl 相关配置 2. 配置 nginx 文件路径 ssl_certificate /usr/local/nginx/ssl/www.aaa.com/cert.pem; ssl_certificate_key /usr/local/nginx/ssl/www.aaa.com/key.pem; 3.
  • linux-三命令(三剑客)之-sed

    使用 sed 对文件进行文本替换 (windows 下也可用) // 输出替换后的文本 sed 's/foo/bar/g' input.txt // 在原文件上进行修改 -i sed -i 's/foo/bar/g' input.txt // 要替换的文本中包含特殊字符 如 '/ ', 则使用 +/_或其它字符 作为分隔符 sed 's+http://+https://+g' input.txt 参考自: www.cyberciti.biz
🍀