start-stop-daemon: matching on world-writable pidfile /var/run/redis/redis-server.pid is insecurefailed
Microsoft Store上 看到最新的Ubuntu 20.04 LTS
已经适配到WSL
上了, 于是卸载了老版本 18.04 LTS
,安装上了最新版本的。
第一次启动会比较慢,需耐心等待
Installing, this may take a few minutes...
看了下WSL
的官方文档,发现WSL
对各种数据库的支持(Ref-1)还真是蛮全的。 更让我惊喜的是WSL和Window其实可以互操作(Ref-2): 既可以从 Windows 命令行运行 Linux 工具,也可以从 Linux 命令行运行 Windows 工具。以前一直以为WSL
只是提供了 Linux 模拟环境,可以让使用 Windows 的开发人员敲敲 Linux 命令,哈哈,认识真的太浅薄了。这对于Redis尤其有用,再也不用安装万年不变的3.2.100(Ref-3)了(当然了,你也可以在Docker使用Redis)。
启动运行Redis,解决启动问题
安装好Redis
以后,在WSL
中运行Redis
root@WSL:~# redis-server --version
Redis server v=5.0.7 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=636cde3b5c7a3923
root@WSL:~# sudo service redis-server start
Starting redis-server: redis-server.
root@WSL:~# redis-cli
127.0.0.1:6379> set Redis "Hello Redis!"
OK
127.0.0.1:6379> get Redis
"Hello Redis!"
设置Redis在后台运行,并查看当前进程(有两个Redis实例在运行)
root@WSL:~# redis-server --daemonize yes
1738:C 16 Aug 2020 18:03:11.055 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1738:C 16 Aug 2020 18:03:11.055 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1738, just started
1738:C 16 Aug 2020 18:03:11.056 # Configuration loaded
root@WSL:~# ps -aux --sort=tty,command
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 8892 284 ? Ssl 17:34 0:00 /init
redis 1602 0.0 0.0 61300 3836 ? Ssl 17:44 0:00 /usr/bin/redis-server 127.0.0.1:6379
root 1739 0.0 0.0 55668 2828 ? Ssl 18:03 0:00 redis-server *:6379
kevin 1643 0.0 0.0 18076 3528 tty1 S 17:46 0:00 -bash
root 1721 0.0 0.0 18080 3516 tty1 S 17:59 0:00 -bash
root 1642 0.0 0.0 8900 204 tty1 Ss 17:46 0:00 /init
root 1743 0.0 0.0 18880 1996 tty1 R 18:06 0:00 ps -aux --sort=tty,command
root 1720 0.0 0.0 18908 2680 tty1 S 17:59 0:00 sudo -i
把玩了一番,发现Redis无法启动,搜了以下,通过删除/var/run/redis/redis-server.pid
解决了问题。
root@WSL:~# sudo service redis-server start
Starting redis-server: start-stop-daemon: matching on world-writable pidfile /var/run/redis/redis-server.pid is insecurefailed
root@WSL:~# rm -f /var/run/redis/redis-server.pid
root@WSL:~# sudo service redis-server start
Starting redis-server: redis-server.
root@WSL:~# sudo service redis-server status
* redis-server is running
通过CMD
或PowerShell
运行 Redis
CMD/PowerShell 通过wsl
命令进入WSL环境, 这时 WSL 会自动挂载当前目录,也可以直接wsl redis-server
(Ref-4)启动 Redis。Redis在standalone模式下,Terminal中无法进行交互。
C:\>wsl
kevin@WSL:/mnt/c# redis-server
2093:C 16 Aug 2020 18:44:15.097 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2093:C 16 Aug 2020 18:44:15.097 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=2093, just started
2093:C 16 Aug 2020 18:44:15.097 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2093:M 16 Aug 2020 18:44:15.098 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2093
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
2093:M 16 Aug 2020 18:44:15.109 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2093:M 16 Aug 2020 18:44:15.110 # Server initialized
2093:M 16 Aug 2020 18:44:15.111 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2093:M 16 Aug 2020 18:44:15.113 * Ready to accept connections
直接挂载C盘根目录可能导致按CTRL
+C
无法退出, 在其他启动的控制台,通过kill -9 pid
终止Redis的运行。
2093:signal-handler (1597575573) Received SIGINT scheduling shutdown...
2093:M 16 Aug 2020 18:59:33.301 # User requested shutdown...
2093:M 16 Aug 2020 18:59:33.302 * Saving the final RDB snapshot before exiting.
2093:M 16 Aug 2020 18:59:33.303 # Failed opening the RDB file dump.rdb (in server root dir /mnt/c) for saving: Permission denied
2093:M 16 Aug 2020 18:59:33.304 # Error trying to save the DB, can't exit.
2093:M 16 Aug 2020 18:59:33.305 # SIGTERM received but errors trying to shut down the server, check the logs for more information
还可以通过redis-server &
使Redis在后台运行(和直接redis-server
运行不同,CTRL
+C
关闭以后,通过ps
命令查看,发现仍在运行)。但是和守护模式(daemonize yes)的STAT(Ref-5) 是不同的。
kevin@WSL:/$ redis-server &
[1] 2329
kevin@WSL:/$ 2329:C 16 Aug 2020 19:36:10.196 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2329:C 16 Aug 2020 19:36:10.196 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=2329, just started
2329:C 16 Aug 2020 19:36:10.196 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2329:M 16 Aug 2020 19:36:10.197 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2329
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
2329:M 16 Aug 2020 19:36:10.202 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2329:M 16 Aug 2020 19:36:10.202 # Server initialized
2329:M 16 Aug 2020 19:36:10.202 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2329:M 16 Aug 2020 19:36:10.202 * Ready to accept connections
^C
kevin@WSL:/$ ps -aux --sort=tty,command
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 8892 264 ? Ssl 17:34 0:00 /init
root 1972 0.0 0.0 55668 2264 ? Ssl 18:20 0:00 redis-server *:6379
redis 2169 0.0 0.0 55668 2768 ? Ssl 18:52 0:00 /usr/bin/redis-server 127.0.0.1:6379
kevin 1643 0.0 0.0 18076 3084 tty1 S 17:46 0:00 -bash
root 1721 0.0 0.0 18212 3432 tty1 S 17:59 0:00 -bash
root 1642 0.0 0.0 8900 176 tty1 Ss 17:46 0:00 /init
root 1720 0.0 0.0 18908 2140 tty1 S 17:59 0:00 sudo -i
kevin 2178 0.0 0.0 18208 3684 tty2 S 19:12 0:00 -bash
root 2177 0.0 0.0 8900 200 tty2 Ss 19:12 0:00 /init
kevin 2333 0.0 0.0 18880 2000 tty2 R 19:36 0:00 ps -aux --sort=tty,command
kevin 2329 0.1 0.0 55668 4080 tty2 Sl 19:36 0:00 redis-server
start-stop-daemon: matching on world-writable pidfile /var/run/redis/redis-server.pid is insecurefailed的更多相关文章
- 启动docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
启动docker提示: docker: Got permission denied while trying to connect to the Docker daemon socket at uni ...
- daemon not running. starting it now on port 5037 ADB server didn't ACK
adb kill-server adb start-server 显示如下 daemon not running. starting it now on port 5037 ADB server di ...
- android搭建环境错误 daemon not running. starting it now on port 5037 ADB server didn't ACK
android搭建环境错误 daemon not running. starting it now on port 5037 ADB server didn't ACK ADB server didn ...
- 【转载】Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 解决办法
Docker Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docke ...
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock.问题解决
出现Cannot connect to the Docker daemon at unix:///var/run/docker.sock时,先用tail -5f /var/log/upstart/do ...
- Docker未启动错误:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
此问题是因为Docker安装后未启动所致,执行以下命令启动docker: systemctl start docker.service 具体日志如下: Connecting to ... Connec ...
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 是由 ...
- Error response from daemon: error creating overlay mount to /var/lib/docker/overlay2
环境:centos7.1 docker run -t -i centos /bin/bash 运行上面的命令开启容器时报错: /usr/bin/docker-current: Error respon ...
- Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/json: dial unix /var/run/docker.sock: conne
使用docker报如下错误信息: Got permission denied while trying to connect to the Docker daemon socket at unix:/ ...
随机推荐
- 设计模式:memento模式
目的:在不破坏系统封装性的前提下,记录系统每一步的状态,可以做到状态回退和前进 方法: 定义一个数据类,保存所有相关数据 定义一个管理类,提供保存和恢复的接口 具体操作类调用管理类的保存和恢复接口 例 ...
- 10种常见OOM分析——手把手教你写bug
点赞+收藏 就学会系列,文章收录在 GitHub JavaKeeper ,N线互联网开发必备技能兵器谱,笔记自取 在<Java虚拟机规范>的规定里,除了程序计数器外,虚拟机内存的其他几个运 ...
- 抽象工厂模式(c++实现)
抽象工厂模式 目录 抽象工厂模式 模式定义 模式动机 UML类图 源码实现 优点 缺点 感悟 模式定义 抽象工厂模式(Abstract Factory),提供一个创建一系列相关或相互依赖对象的接口,而 ...
- 图像增强 | CLAHE 限制对比度自适应直方图均衡化
1 基本概述 CLAHE是一个比较有意思的图像增强的方法,主要用在医学图像上面.之前的比赛中,用到了这个,但是对其算法原理不甚了解.在这里做一个复盘. CLAHE起到的作用简单来说就是增强图像的对比度 ...
- 01_Linux基础篇
学于黑马.传智播客.尚硅谷 感谢 黑马官网 传智播客官网 尚硅谷官网 微信搜索"艺术行者",关注并回复关键词"linux"获取视频和教程资料! b站在线视频 第 ...
- Tkinter经典写法
1.继承 tkinter.Frame 类,实现类的基本写法 2.创建主窗口及主窗口大小位置及标题 3.将需要添加的组件放入到类中进行创建, 继承的 Frame 类需要使用 master 参数作为父类的 ...
- The JOIN operation -- SQLZOO
The JOIN operation 注意:where语句中对表示条件的需要用单引号, 下面的译文使用的是有道翻译如有不正确,请直接投诉有道 01.Modify it to show the matc ...
- python基础day7_购物车实例
print("欢迎光临") money = input("请输入您的金额:") shopping_car ={} li = [{"name" ...
- SpringBoot2 整合 Swagger2文档 使用BootstrapUI页面
SpringBoot2 整合 Swagger2 SpringBoot整合三板斧 第一步.引入pom <dependency> <groupId>com.spring4all&l ...
- MyBatis-Plus使用(4)-集成SpringBoot
我这里使用的MyBatis-Plus是当前最新的3.2.0版本, 1. 引入需要的jar,基础jar包括: <dependencies> <dependency> <gr ...