上QQ阅读APP看书,第一时间看更新
1.4 预备工作
本书包含大量Redis命令操作实例和Python代码应用示例,执行和测试这些示例需要用到Redis服务器及其附带的redis-cli客户端、Python编程环境和redis-py客户端,如果你尚未安装这些软件,那么请查阅附录A和附录B并按照指引进行安装。
在正确安装Redis服务器之后,可以通过执行以下命令启动Redis服务器:
$ redis-server 28393:C 02 Jul 2019 23:49:25.952 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 28393:C 02 Jul 2019 23:49:25.952 # Redis version=999.999.999, bits=64, commit=0cabe0cf, modified=1, pid=28393, just started 28393:C 02 Jul 2019 23:49:25.952 # Warning: no config file specified, using the default config. In order to specify a config file use /Users/huangz/code/ redis/src/redis-server /path/to/redis.conf 28393:M 02 Jul 2019 23:49:25.953 * Increased maximum number of open files to
10032 (it was originally set to 256). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 999.999.999 (0cabe0cf/1) 64 bit .-`` .-```. ```\/ _., _ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 28393 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 28393:M 02 Jul 2019 23:49:25.954 # Server initialized 28393:M 02 Jul 2019 23:49:25.954 * Ready to accept connection
并通过以下命令启动redis-cli客户端:
$ redis-cli 127.0.0.1:6379>
以及通过以下命令启动Python解释器并载入redis-py库:
$ python3 Python 3.7.3 (default, Mar 272019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from redis import Redis >>>
上述准备工作圆满完成之后,我们就可以开始学习Redis命令的基本知识了。