Fix mysqlbinlog command missing for docker containers

Sometimes we want to use the MySQL docker container to test some binlog-related features, but unfortunately, the default tag of the official docker image doesn’t contain the binlog utilities, please refer to https://github.com/docker-library/mysql/issues/907 and https://github.com/docker-library/mysql/issues/847

What shall we do about this case?

For testing, it’s pretty straightforward: just use the Debian-based images

for example previously used an image that doesn’t contain the binlog tools: mysql:5.7.39, then we switch to using mysql:5.7.39-debian, the mysqlbinlog will appear after we do the switch.

windows 升级遇到 0x80092004 错误

windows 升级遇到 0x80092004 错误时候需要单独下载两个更新文件,并手动更新

servicing stack update

https://support.microsoft.com/en-sg/help/4490628/servicing-stack-update-for-windows-7-sp1-and-windows-server-2008-r2

SHA-2 code signing support update

https://support.microsoft.com/en-us/help/4474419/sha-2-code-signing-support-update

Could not resolve host:mirrors.cloud.aliyuncs.com

通过yum 在阿里云的Centos ECS中安装或更新软件的时候有时会遇到

http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 – “Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error”

出现这种问题可能是因为把专有网络的镜像复制到了经典网络,而未修改阿里云yum源的域名,以下是阿里云不同的网络类型所对应的的域名

  • (默认)公网:mirrors.aliyun.com (需要实例具有公网访问)
  • 专有网络VPC内网:mirrors.cloud.aliyuncs.com
  • 经典网络内网:mirrors.aliyuncs.com

对于Centos/Alibaba Cloud Linux

需要编辑/etc/yum.repo.d/下面的配置文件,删除 mirrors.cloud.aliyuncs.com或替换为mirrors.aliyun.com

yum clean all

yum make cache

对于Debian/Ubuntu 类系统

我们编辑/etc/apt/sources.list 以及/etc/apt/sources.list.d/ 下的文件

替换域名为当前实例网络类型对应的域名

  • (默认)公网:mirrors.aliyun.com (需要实例具有公网访问)
  • 专有网络VPC内网:mirrors.cloud.aliyuncs.com
  • 经典网络内网:mirrors.aliyuncs.com

一般我们通过sed 命令一键替换

比如我们要把专有网络VPC内网源的域名更换为公网源的域名我们可以这样做:

sed -i 's/mirrors.cloud.aliyuncs.com/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-Base.repo

在macOS上安装配置selenium-python

1. 用homebrew安装较新版本的python2.7

brew install python

sudo -H easy_install pip

 

2. 安装selenium

sudo -H pip install selenium

 

3. 安装selenium webdriver

Firefox:
到https://github.com/mozilla/geckodriver/releases下载macOS版本的driver解压出来,复制到/usr/local/bin

sudo cp ~/Download/geckodriver /usr/local/bin

 

Chrome

到https://chromedriver.storage.googleapis.com/index.html下载chromedriver,和firefox版一样复制到/usr/local/bin

sudo cp ~/Download/chromedriver /usr/local/bin

 

4. 检查安装

在python console

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('https://www.baidu.com')

 

能够成功打开浏览器,并打开网页,说明安装成功。

note: 必须要保证系统里面安装了Firefox或者Chrome浏览器
不然可能会有如下的异常:

selenium.common.exceptions.WebDriverException: Message: Expected browser binary location,
but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

 

升级阿里云centos kernel修复CVE-2016-5195(Dirty COW)

  1. 检查是否受影响:
    wget https://access.redhat.com/sites/default/files/rh-cve-2016-5195_1.sh
    bash ~/rh-cve-2016-5195_1.sh
    Your kernel is 2.6.32-358.6.2.el6.x86_64 which IS vulnerable.
    
  2. 修改 /etc/yum.conf, 删除掉exclude的kernel部分
    #exclude=*.i?86 kernel kernel-xen kernel-debug
    exclude=*.i?86 kernel-xen kernel-debug
  3. 执行升级
    yum update kernel
    Loaded plugins: fastestmirror
    Setting up Update Process
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyuncs.com
     * epel: mirrors.aliyuncs.com
     * extras: mirrors.aliyuncs.com
     * updates: mirrors.aliyuncs.com
    base                                                                                                                                   | 3.7 kB     00:00     
    epel                                                                                                                                   | 4.3 kB     00:00     
    extras                                                                                                                                 | 3.4 kB     00:00     
    updates                                                                                                                                | 3.4 kB     00:00     
    Resolving Dependencies
    --> Running transaction check
    ---> Package kernel.x86_64 0:2.6.32-642.6.2.el6 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ==============================================================================================================================================================
     Package                           Arch                              Version                                         Repository                          Size
    ==============================================================================================================================================================
    Installing:
     kernel                            x86_64                            2.6.32-642.6.2.el6                              updates                             32 M
    
    Transaction Summary
    ==============================================================================================================================================================
    Install       1 Package(s)
    
    Total download size: 32 M
    Installed size: 131 M
    Is this ok [y/N]: y
    Downloading Packages:
    kernel-2.6.32-642.6.2.el6.x86_64.rpm                                                                                                   |  32 MB     00:31     
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing : kernel-2.6.32-642.6.2.el6.x86_64                                                                                                           1/1 
      Verifying  : kernel-2.6.32-642.6.2.el6.x86_64                                                                                                           1/1 
    
    Installed:
      kernel.x86_64 0:2.6.32-642.6.2.el6                                                                                                                          
    
    Complete!
    
    
  4. 重启服务器
    reboot
  5. 再次执行脚本,确认修复
    bash ~/rh-cve-2016-5195_1.sh
    Your kernel is 2.6.32-642.6.2.el6.x86_64 which is NOT vulnerable.
    

 

iphone热点不能联网

 

打开iphone的热点功能,

笔记本能连接上,但是显示无internet连接,

查看ipconfig

无线局域网适配器 无线网络连接:

连接特定的 DNS 后缀 . . . . . . . :
自动配置 IPv4 地址 . . . . . . . : 169.254.64.152
子网掩码 . . . . . . . . . . . . : 255.255.0.0
默认网关. . . . . . . . . . . . . :

 

估计可能是iphone的dhcp功能有问题,重启iphone,还是不行,

把ip v4设置为手动,如下

无线局域网适配器 无线网络连接:

连接特定的 DNS 后缀 . . . . . . . :
IPv4 地址 . . . . . . . . . . . . : 172.20.10.2
子网掩码 . . . . . . . . . . . . : 255.255.255.240
默认网关. . . . . . . . . . . . . : 172.20.10.1

 

发现已经可以连接