Activates the cache for connections to upstream servers.
The connections parameter sets the maximum number of idle keepalive connections to upstream servers that are preserved in the cache of each worker process. When this number is exceeded, the least recently used connections are closed.
Mac 和 Windows 哪个更好,估计还能再吵几年。抛开部分硬件上的差距,Windows 用作开发上确实有点不顺手,毕竟大部分后端程序都是运行在 Linux 服务器上,macOS 占有先天优势。之前都是通过在 Windows 上起虚拟机来解决这个问题,如今 Windows 10 推出的 WSL(Windows Subsystem for Linux),成为了新的选择。
The Windows Subsystem for Linux lets developers run GNU/Linux environment - including most command-line tools, utilities, and applications - directly on Windows, unmodified, without the overhead of a virtual machine
简单来说就是不需要修改,无需虚拟机,就可以在 Windows 上直接使用 Linux 环境(grep, sed, awkd等),运行 Linux 程序(vim, MySQL, Apache等)。这就很舒服了,小孩子才做选择,大人全都要,实际如何我们来实践一番。
之前在 Windows 上使用 Redis 比较麻烦,有一个 Windows 版的 Redis 但已经很久没有更新了,还有就是选择虚拟机。现在直接在 WSL 里面编译安装(make & make install)就行了。写好配置文件,sudo redis-server /etc/redis/redis.conf 运行即可。
不过有些同学可能会像我之前把 Redis 注册为 systemd 服务,但发现会报错:System has not been booted with systemd as init system (PID 1). Can't operate 说的也比较明白,系统不是通过 systemd 启动的。其实 WSL 不是一个真正的系统,应该说是一个容器,类似 Docker(这么一说感觉微软野心好大)。
在 WSL 中运行的程序是真正的 Linux 二进制文件,不是移植版,不过当程序由用户态切换到内核态时lxss.sys和lxcore.sys驱动将会将 Linux 的系统调用翻译为 NT APIs 来模拟 Linux 内核。简单来说 WSL 是将 LInux 底层 API 用 NT 实现了一遍(所以 WSL 中没有 Linux kernel 代码),而且有些操作还是 Linux 独有的,比如fork(),可想而知这里面工作量有多大,任重而道远。
言归正传,Redis 已经在 WSL 中启动了,我们试试在 Windows 上能不能连上:
完美,就和 Windows 本地装的 Redis 一样。
与IDE集成
虽然说大部分语言都是跨平台的,但是还是有很多差别,比如 Python 的 epoll 只能在 Linux 下使用。在 Windows 上开发不是很方便,没有智能提示,还需要上传到服务器运行、调试。有了 WSL,现在可以在 Windows 上开发,然后直接在 WSL 里面运行。 Continue Reading...
Since release 3.5.0 phpMyAdmin can be configured to remember several things (sorted column $cfg['RememberSorting'], column order, and column visibility from a database table) for browsing tables. Without configuring the storage, these features still can be used, but the values will disappear after you logout.
For GET and HEAD methods, used in combination with an Range header, it can guarantee that the new ranges requested comes from the same resource than the previous one. If it doesn't match, then a 416 (Range Not Satisfiable) response is returned.
当然我这个案例中错误码是 412(通常用作 PUT 方法更新资源出错时),不过这是一个意思,符合预期。
这时你登录的话需要使用 socket 方式连入:sudo mysql --protocol=socket --socket=/var/run/mysqld/mysqld.sock,注意这里需要用 root 权限运行,保证有足够权限读取 sock 文件,不然会默认使用当前用户进行传统的 ip+port 登录,这样肯定是登录不上的。登录上去就可以改 root 密码了,正常执行ALTER USER 'root'@'localhost' IDENTIFIED BY 'test';后发现密码并没有被改变(会报 warning),观察上面的截图会发现 root 账号的认证插件用的是auth_socket,我们需要这样执行命令ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';。就能回到传统的账号密码认证了。
3. 细心的同学可能已经发现了,多了一个mysql.sys的用户,按照官方的说法这是给 DBA 使用的,防止直接使用 root 账号带来的重命名和误删账号的问题。这个用户默认有一个初始密码,但在日志里面没找到(源码编译 MySQL 5.7 后 mysql_install_db –initialize 时会把密码记录到日志中)。这里索性重新设置一个密码(ALTER USER 'mysql.sys'@'localhost' IDENTIFIED BY 'test';)。
到这儿基本上已经安装完成了,但若你细心的话会发现在启动日志里面会有一些警告:
1. TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 这个是说explicit_defaults_for_timestamp缺省值已经废弃了,需要显式的在 my.cnf 设置 explicit_defaults_for_timestamp = 1
2. [Warning] Could not increase number of max_open_files to more than 5000 (request: 65535) 这是个常见的错误,一般修改 /etc/security/limits.conf 即可,但改了之后好像不奏效。这是因为在 /lib/systemd/system/mysql.service 配置中还有参数 LimitNOFILE 限制,把这里也修改了就可以了。
最后介绍一个比较好用的命令:mysql_config_editor,解决命令行登录MySQL便捷性和安全性的问题。我们为了本地登录MySQL方便经常会写一些一键登录的小脚本。基本上都是直接执行 mysql -uroot -p'test' 命令,这样会带来一个问题,执行的命令会被记录在bash_history中,当然你也可以禁用bash_history的功能,但这样会失去一些便捷性,也不大方便追查历史的问题命令。而且在新版本中直接使用这种方式登录会有警告信息。
好久没写 css 了,百思不得其解,试过 .article-content > ol, ul、.article-content section > ol, ul 都不行,甚至怀疑同级标签也有继承的关系。后来发现其它地方会把 class 标签写两次才恍然大悟,应该是逗号「,」优先级更高一点,把选择器解析成了 .article-content ol 和 ul 两部分,所以选择器写成 .article-content ol, .article-content ul 就可以了。