Redis安装与启动

 概述

Redis【REmote DIctionary Server】作为当前比较流行的NoSql数据库,以其高性能,高可用的的特点,应用越来越广泛,深得各大企业和开发人员的青睐,本文主要简述Redis的下载,安装,启动,关闭的整个流程,仅供学习分享使用,如有不足之处,还请指正。

什么是Redis?

Redis 是完全开源的,遵守 BSD 协议,是一个高性能的 key-value 数据库。
Redis 与其他 key - value 缓存产品有以下三个特点:
  1. Redis支持数据的持久化,可以将内存中的数据保存在磁盘中,重启的时候可以再次加载进行使用。
  2. Redis不仅仅支持简单的key-value类型的数据,同时还提供list,set,zset,hash等数据结构的存储。
  3. Redis支持数据的备份,即master-slave模式的数据备份。

Redis 优势

  • 性能极高 – Redis能读的速度是110000次/s,写的速度是81000次/s 。
  • 丰富的数据类型 – Redis支持二进制案例的 Strings,Lists,Hashes,Sets 及 Ordered Sets 数据类型操作。
  • 原子 – Redis的所有操作都是原子性的,意思就是要么成功执行要么失败完全不执行。单个操作是原子性的。多个操作也支持事务,即原子性,通过MULTI和EXEC指令包起来。
  • 丰富的特性 – Redis还支持 publish/subscribe,通知,key 过期等等特性。

Redis安装环境

  • 操作系统:Linux CentOS 7.0 64位操作系统
  • Redis版本:稳定版 redis6.0.9

Redis下载安装包

Redis的安装包,可以到Redis官网进行下载最新稳定版本,目前的稳定版本为redis6.0.9,如下所示:

Redis安装

1. 下载安装包【redis-6.0.9.tar.gz】以后,通过Xftp工具,上传到Linux系统中 HOME/DownLoad中。然后切换到home/DownLoad 并通过 【tar -zxvf redis-6.0.9.tar.gz 】进行解压到当前目录。如下所示:

2. 通过过cp -r redis-6.0.9 /usr/local/src/redis 命令,将复制解压后的目录到/usr/local/src目录下,并修改文件夹名称为redis。如下所示:

3. 通过gcc -v命令检测gcc是否安装。如下所示:

 4. 如果没有安装,则通过yum install gcc-c++命令进行安装,如下所示:

5. gcc安装成功后,进入到/usr/local/src/redis/deps目录下,对hiredis lua jemalloc linenoise 四个进行预编译,命令为【 make hiredis lua jemalloc linenoise 】编译过程无error出现,则表示预编译成功。如下所示:

  1 [root@bogon deps]# ls
  2 hiredis  jemalloc  linenoise  lua  Makefile  README.md  update-jemalloc.sh
  3 [root@bogon deps] make hiredis lua jemalloc linenoise
  4 MAKE hiredis
  5 cd hiredis && make static 
  6 make[1]: Entering directory `/usr/local/src/redis/deps/hiredis'
  7 make[1]: Nothing to be done for `static'.
  8 make[1]: Leaving directory `/usr/local/src/redis/deps/  9 MAKE lua
 10 cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI -DENABLE_CJSON_GLOBAL -DREDIS_STATIC='' " MYLDFLAGS="" AR=ar rcu"
 11 make[1]: Entering directory `/usr/local/src/redis/deps/lua/src'
 12 make[1]: Nothing to be done  `all'.
 13 make[1]: Leaving directory `/usr/local/src/redis/deps/lua/ 14 MAKE jemalloc
 15 cd jemalloc && ./configure --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS=-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
 16 configure: WARNING: unrecognized options: --enable-cc-silence
 17 checking for xsltproc... /usr/bin/xsltproc
 18 checking  gcc... gcc
 19 checking whether the C compiler works... yes
 20 checking for C compiler default output file name... a.out
 21 checking  suffix of executables... 
 22 checking whether we are cross compiling... no
 23 checking  suffix of object files... o
 24 checking whether we are using the GNU C compiler... yes
 25 checking whether gcc accepts -g... yes
 26 checking  gcc option to accept ISO C89... none needed
 27 checking whether compiler is cray... no
 28 checking whether compiler supports -std=gnu11... yes
 29 checking whether compiler supports -Wall... yes
 30 checking whether compiler supports -Wshorten-64-to-32... no
 31 checking whether compiler supports -Wsign-compare... yes
 32 checking whether compiler supports -Wundef... yes
 33 checking whether compiler supports -Wno-format-zero-length... yes
 34 checking whether compiler supports -pipe... yes
 35 checking whether compiler supports -g3... yes
 36 checking how to run the C preprocessor... gcc -E
 37 checking for g++... g++
 38 checking whether we are using the GNU C++ compiler... yes
 39 checking whether g++ accepts - 40 checking whether g++ supports C++14 features by  41 checking whether g++ supports C++14 features with -std=c++14 42 checking whether g++ supports C++14 features with -std=c++0x... no
 43 checking whether g++ supports C++14 features with +std=c++14 44 checking whether g++ supports C++14 features with -h std=c++14 45 configure: No compiler with C++14 support was found
 46 checking for grep that handles long lines and -e... /usr/bin/grep
 47 checking for egrep... /usr/bin/grep - 48 checking  ANSI C header files... yes
 49 checking for sys/types.h... yes
 50 checking stat.h... yes
 51 checking  stdlib.h... yes
 52 checking  string.h... yes
 53 checking  memory.h... yes
 54 checking  strings.h... yes
 55 checking  inttypes.h... yes
 56 checking  stdint.h... yes
 57 checking  unistd.h... yes
 58 checking whether byte ordering is bigendian... no
 59 checking size of void *... 8
 60 checking size of int... 4
 61 checking size of long... 8
 62 checking size of long long... 8
 63 checking size of intmax_t... 8
 64 checking build system type... x86_64-pc-linux-gnu
 65 checking host system type... x86_64-pc-linux- 66 checking whether pause instruction is compilable... yes
 67 checking number of significant virtual address bits... 48
 68 checking  ar... ar
 69 checking  nm... nm
 70 checking  gawk... gawk
 71 checking malloc.h usability... yes
 72 checking malloc.h presence... yes
 73 checking  malloc.h... yes
 74 checking whether malloc_usable_size definition can use const argument... no
 75 checking for library containing log... -lm
 76 checking whether __attribute__ syntax is compilable... yes
 77 checking whether compiler supports -fvisibility=hidden... yes
 78 checking whether compiler supports -fvisibility= 79 checking whether compiler supports -Werror... yes
 80 checking whether compiler supports -herror_on_warning... no
 81 checking whether tls_model attribute is compilable... yes
 82 checking whether compiler supports - 83 checking whether compiler supports - 84 checking whether alloc_size attribute is compilable... yes
 85 checking whether compiler supports - 86 checking whether compiler supports - 87 checking whether format(gnu_printf,...) attribute is compilable... yes
 88 checking whether compiler supports - 89 checking whether compiler supports - 90 checking whether format(printf,1)"> 91 checking for a BSD-compatible install... /usr/bin/install -c
 92 checking  ranlib... ranlib
 93 checking for ld... /usr/bin/ld
 94 checking for autoconf... false
 95 checking  memalign... yes
 96 checking  valloc... yes
 97 checking whether compiler supports -O3... yes
 98 checking whether compiler supports - 99 checking whether compiler supports -funroll-loops... yes
100 checking configured backtracing method... N/A
101 checking  sbrk... yes
102 checking whether utrace(2) is compilable... no
103 checking whether a program using __builtin_unreachable is compilable... yes
104 checking whether a program using __builtin_ffsl is compilable... yes
105 checking LG_PAGE... 12
106 checking pthread.h usability... yes
107 checking pthread.h presence... yes
108 checking  pthread.h... yes
109 checking for pthread_create in -lpthread... yes
110 checking dlfcn.h usability... yes
111 checking dlfcn.h presence... yes
112 checking  dlfcn.h... yes
113 checking  dlsym... no
114 checking for dlsym ldl... yes
115 checking whether pthread_atfork(3) is compilable... yes
116 checking whether pthread_setname_np(3117 checking  library containing clock_gettime... none required
118 checking whether clock_gettime(CLOCK_MONOTONIC_COARSE,...) is compilable... yes
119 checking whether clock_gettime(CLOCK_MONOTONIC,1)">120 checking whether mach_absolute_time() is compilable... no
121 checking whether compiler supports -122 checking whether syscall(2123 checking  secure_getenv... yes
124 checking  sched_getcpu... yes
125 checking  sched_setaffinity... yes
126 checking  issetugid... no
127 checking  _malloc_thread_cleanup... no
128 checking  _pthread_mutex_init_calloc_cb... no
129 checking  TLS... yes
130 checking whether C11 atomics is compilable... no
131 checking whether GCC __atomic atomics is compilable... yes
132 checking whether GCC __sync atomics is compilable... yes
133 checking whether Darwin OSAtomic*() is compilable... no
134 checking whether madvise(2135 checking whether madvise(...,MADV_FREE) is compilable... no
136 137 138 139 checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
140 checking whether to force 64-141 checking  __builtin_clz... yes
142 checking whether Darwin os_unfair_lock_*143 checking whether Darwin OSSpin*144 checking whether glibc malloc hook is compilable... yes
145 checking whether glibc memalign hook is compilable... yes
146 checking whether pthreads adaptive mutexes is compilable... yes
147 checking whether compiler supports -D_GNU_SOURCE... yes
148 checking whether compiler supports -149 checking whether compiler supports -150 checking whether strerror_r returns char with gnu source is compilable... yes
151 checking  stdbool.h that conforms to C99... yes
152 checking  _Bool... yes
153 configure: creating ./config.status
154 config.status: creating Makefile
155 config.status: creating jemalloc.pc
156 config.status: creating doc/html.xsl
157 config.status: creating doc/manpages.xsl
158 config.status: creating doc/jemalloc.xml
159 config.status: creating include/jemalloc/jemalloc_macros.h
160 config.status: creating include/jemalloc/jemalloc_protos.h
161 config.status: creating include/jemalloc/jemalloc_typedefs.h
162 config.status: creating include/jemalloc/internal/jemalloc_preamble.h
163 config.status: creating test/test.sh
164 config.status: creating test/include/test/jemalloc_test.h
165 config.status: creating config.stamp
166 config.status: creating bin/jemalloc-config
167 config.status: creating bin/168 config.status: creating bin/jeprof
169 config.status: creating include/jemalloc/jemalloc_defs.h
170 config.status: include/jemalloc/jemalloc_defs.h is unchanged
171 config.status: creating include/jemalloc/internal/jemalloc_internal_defs.h
172 config.status: include/jemalloc/internal/jemalloc_internal_defs.h is unchanged
173 config.status: creating test/include/test/jemalloc_test_defs.h
174 config.status: test/include/test/jemalloc_test_defs.h is unchanged
175 config.status: executing include/jemalloc/internal/public_symbols.txt commands
176 config.status: executing include/jemalloc/internal/private_symbols.awk commands
177 config.status: executing include/jemalloc/internal/private_symbols_jet.awk commands
178 config.status: executing include/jemalloc/internal/public_namespace.h commands
179 config.status: executing include/jemalloc/internal/public_unnamespace.h commands
180 config.status: executing include/jemalloc/internal/size_classes.h commands
181 config.status: executing include/jemalloc/jemalloc_protos_jet.h commands
182 config.status: executing include/jemalloc/jemalloc_rename.h commands
183 config.status: executing include/jemalloc/jemalloc_mangle.h commands
184 config.status: executing include/jemalloc/jemalloc_mangle_jet.h commands
185 config.status: executing include/jemalloc/jemalloc.h commands
186 configure: WARNING: unrecognized options: --enable-cc-187 ===============================================================================
188 jemalloc version   : 5.1.0-0-g0
189 library revision   : 2
190 
191 CONFIG             : --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence 'CFLAGS=-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops ' LDFLAGS=
192 CC                 : gcc
193 CONFIGURE_CFLAGS   : -std=gnu11 -Wall -Wsign-compare -Wundef -Wno-format-zero-length -pipe -g3 -fvisibility=hidden -O3 -funroll-loops
194 SPECIFIED_CFLAGS   : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops 
195 EXTRA_CFLAGS       : 
196 CPPFLAGS           : -D_GNU_SOURCE -D_REENTRANT
197 CXX                : g++
198 CONFIGURE_CXXFLAGS : -fvisibility=hidden -O3
199 SPECIFIED_CXXFLAGS : 
200 EXTRA_CXXFLAGS     : 
201 LDFLAGS            : 
202 EXTRA_LDFLAGS      : 
203 DSO_LDFLAGS        : -shared -Wl,-soname,$(@F)
204 LIBS               : -lm  -lpthread -ldl
205 RPATH_EXTRA        : 
206 
207 XSLTPROC           : /usr/bin/208 XSLROOT            : 
209 
210 PREFIX             : /usr/local
211 BINDIR             : /usr/local/bin
212 DATADIR            : /usr/local/share
213 INCLUDEDIR         : /usr/local/include
214 LIBDIR             : /usr/local/lib
215 MANDIR             : /usr/local/share/man
216 
217 srcroot            : 
218 abs_srcroot        : /usr/local/src/redis/deps/jemalloc/
219 objroot            : 
220 abs_objroot        : /usr/local/src/redis/deps/jemalloc/
221 
222 JEMALLOC_PREFIX    : je_
223 JEMALLOC_PRIVATE_NAMESPACE
224                    : je_
225 install_suffix     : 
226 malloc_conf        : 
227 autogen            : 0
228 debug              : 0
229 stats              : 1
230 prof               : 0
231 prof-libunwind     : 0
232 prof-libgcc        : 0
233 prof-gcc           : 0
234 fill               : 1
235 utrace             : 0
236 xmalloc            : 0
237 log                : 0
238 lazy_lock          : 0
239 cache-oblivious    : 1
240 cxx                : 0
241 ===============================================================================
242 cd jemalloc && make CFLAGS="" lib/libjemalloc.a
243 make[1]: Entering directory `/usr/local/src/redis/deps/jemalloc'
244 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/jemalloc.sym.o src/jemalloc.c
245 nm -a src/jemalloc.sym.o | gawk -f include/jemalloc/internal/private_symbols.awk > src/jemalloc.sym
246 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/arena.sym.o src/arena.c
247 nm -a src/arena.sym.o | gawk arena.sym
248 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/background_thread.sym.o src/background_thread.c
249 nm -a src/background_thread.sym.o | gawk background_thread.sym
250 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/base.sym.o src/base.c
251 nm -a src/base.sym.o | gawk base.sym
252 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/bin.sym.o src/bin.c
253 nm -a src/bin.sym.o | gawk bin.sym
254 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/bitmap.sym.o src/bitmap.c
255 nm -a src/bitmap.sym.o | gawk bitmap.sym
256 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/ckh.sym.o src/ckh.c
257 nm -a src/ckh.sym.o | gawk ckh.sym
258 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/ctl.sym.o src/ctl.c
259 nm -a src/ctl.sym.o | gawk ctl.sym
260 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/div.sym.o src/div.c
261 nm -a src/div.sym.o | gawk div.sym
262 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/extent.sym.o src/extent.c
263 nm -a src/extent.sym.o | gawk extent.sym
264 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/extent_dss.sym.o src/extent_dss.c
265 nm -a src/extent_dss.sym.o | gawk extent_dss.sym
266 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/extent_mmap.sym.o src/extent_mmap.c
267 nm -a src/extent_mmap.sym.o | gawk extent_mmap.sym
268 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/hash.sym.o src/hash.c
269 nm -a src/hash.sym.o | gawk hash.sym
270 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/hooks.sym.o src/hooks.c
271 nm -a src/hooks.sym.o | gawk hooks.sym
272 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/large.sym.o src/large.c
273 nm -a src/large.sym.o | gawk large.sym
274 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/log.sym.o src/log.c
275 nm -a src/log.sym.o | gawk log.sym
276 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/malloc_io.sym.o src/malloc_io.c
277 nm -a src/malloc_io.sym.o | gawk malloc_io.sym
278 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/mutex.sym.o src/mutex.c
279 nm -a src/mutex.sym.o | gawk mutex.sym
280 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/mutex_pool.sym.o src/mutex_pool.c
281 nm -a src/mutex_pool.sym.o | gawk mutex_pool.sym
282 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/nstime.sym.o src/nstime.c
283 nm -a src/nstime.sym.o | gawk nstime.sym
284 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/pages.sym.o src/pages.c
285 nm -a src/pages.sym.o | gawk pages.sym
286 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/prng.sym.o src/prng.c
287 nm -a src/prng.sym.o | gawk prng.sym
288 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/prof.sym.o src/prof.c
289 nm -a src/prof.sym.o | gawk prof.sym
290 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/rtree.sym.o src/rtree.c
291 nm -a src/rtree.sym.o | gawk rtree.sym
292 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/stats.sym.o src/stats.c
293 nm -a src/stats.sym.o | gawk stats.sym
294 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/sz.sym.o src/sz.c
295 nm -a src/sz.sym.o | gawk sz.sym
296 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/tcache.sym.o src/tcache.c
297 nm -a src/tcache.sym.o | gawk tcache.sym
298 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/ticker.sym.o src/ticker.c
299 nm -a src/ticker.sym.o | gawk ticker.sym
300 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/tsd.sym.o src/tsd.c
301 nm -a src/tsd.sym.o | gawk tsd.sym
302 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -DJEMALLOC_NO_PRIVATE_NAMESPACE -o src/witness.sym.o src/witness.c
303 nm -a src/witness.sym.o | gawk witness.sym
304 /bin/sh include/jemalloc/internal/private_namespace.sh src/jemalloc.sym src/arena.sym src/background_thread.sym src/base.sym src/bin.sym src/bitmap.sym src/ckh.sym src/ctl.sym src/div.sym src/extent.sym src/extent_dss.sym src/extent_mmap.sym src/hash.sym src/hooks.sym src/large.sym src/log.sym src/malloc_io.sym src/mutex.sym src/mutex_pool.sym src/nstime.sym src/pages.sym src/prng.sym src/prof.sym src/rtree.sym src/stats.sym src/sz.sym src/tcache.sym src/ticker.sym src/tsd.sym src/witness.sym > include/jemalloc/internal/private_namespace.gen.h
305 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/306 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/307 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/background_thread.o src/308 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/309 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bin.o src/310 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/311 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/312 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/313 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/div.o src/314 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/315 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent_dss.o src/316 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent_mmap.o src/317 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/318 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hooks.o src/319 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/large.o src/320 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/log.o src/321 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/malloc_io.o src/322 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/323 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex_pool.o src/324 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/nstime.o src/325 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/pages.o src/326 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prng.o src/327 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/328 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/329 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/330 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/sz.o src/331 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/332 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ticker.o src/333 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/334 gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/witness.o src/335 ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/background_thread.o src/base.o src/bin.o src/bitmap.o src/ckh.o src/ctl.o src/div.o src/extent.o src/extent_dss.o src/extent_mmap.o src/hash.o src/hooks.o src/large.o src/log.o src/malloc_io.o src/mutex.o src/mutex_pool.o src/nstime.o src/pages.o src/prng.o src/prof.o src/rtree.o src/stats.o src/sz.o src/tcache.o src/ticker.o src/tsd.o src/witness.o
336 make[1]: Leaving directory `/usr/local/src/redis/deps/337 MAKE linenoise
338 cd linenoise && make
339 make[1]: Entering directory `/usr/local/src/redis/deps/linenoise'
340 make[1]: `linenoise.o' is up to date.
341 make[1]: Leaving directory `/usr/local/src/redis/deps/342 [root@bogon deps]# 
View Code

6. 预编译成功后,则返回上级目录进一步对redis进行编译。命令为【make】,编译过程如下所示:

 1 [root@bogon redis] make
 2 cd src && make all
 3 make[1]: Entering directory `/usr/local/src/redis/ 4     CC Makefile.dep
 5 make[1]: Leaving directory `/usr/local/src/redis/ 6 make[1]: Entering directory `/usr/local/src/redis/ 7     CC server.o
 8     CC sds.o
 9     CC zmalloc.o
10     CC lzf_c.o
11     CC lzf_d.o
12     CC pqsort.o
13     CC zipmap.o
14     CC sha1.o
15     CC ziplist.o
16     CC release.o
17     CC networking.o
18     CC util.o
19     CC object.o
20     CC db.o
21     CC replication.o
22     CC rdb.o
23     CC t_string.o
24     CC t_list.o
25     CC t_set.o
26     CC t_zset.o
27     CC t_hash.o
28     CC config.o
29     CC aof.o
30     CC pubsub.o
31     CC multi.o
32     CC debug.o
33     CC sort.o
34     CC intset.o
35     CC syncio.o
36     CC cluster.o
37     CC crc16.o
38     CC endianconv.o
39     CC slowlog.o
40     CC scripting.o
41     CC bio.o
42     CC rio.o
43     CC rand.o
44     CC memtest.o
45     CC crcspeed.o
46     CC crc64.o
47     CC bitops.o
48     CC sentinel.o
49     CC notify.o
50     CC setproctitle.o
51     CC blocked.o
52     CC hyperloglog.o
53     CC latency.o
54     CC sparkline.o
55     CC redis-check-rdb.o
56     CC redis-check-aof.o
57     CC geo.o
58     CC lazyfree.o
59     CC module.o
60     CC evict.o
61     CC expire.o
62     CC geohash.o
63     CC geohash_helper.o
64     CC childinfo.o
65     CC defrag.o
66     CC siphash.o
67     CC rax.o
68     CC t_stream.o
69     CC listpack.o
70     CC localtime.o
71     CC lolwut.o
72     CC lolwut5.o
73     CC lolwut6.o
74     CC acl.o
75     CC gopher.o
76     CC tracking.o
77     CC connection.o
78     CC tls.o
79     CC sha256.o
80     CC timeout.o
81     CC setcpuaffinity.o
82     LINK redis-server
83     INSTALL redis-sentinel
84     CC redis-cli.o
85     LINK redis-cli
86     CC redis-benchmark.o
87     LINK redis-benchmark
88     INSTALL redis-check-rdb
89     INSTALL redis-check-aof
90 
91 Hint: It's a good idea to run 'make test' ;)
92 
93 make[1]: Leaving directory `/usr/local/src/redis/src'
View Code

当出现如下所示,则表示编译成功,如下所示:

 6. 编译成功后,则显示如下所示:

7. 通过mkdir /usr/local/redis 命令在/usr/local目录下,创建redis文件夹。然后通过make install PREFIX=/usr/local/redis 命令进行安装redis。

 8. 安装成功后,切换到/usr/local/redis/bin目录下进行查看,存在如下所示文件则表示安装成功。

 9. 在root目录下,创建myredis文件夹,并将/usr/local/src/redis/redis.conf 文件复制到myredis文件夹下。【目的:方便后续修改】

复制命令为【cp redis.conf /root/myredis】执行过程如下所示:

 1 [root@bogon bin] mkdir /root/myredis
 2 [root@bogon bin] cd ../../
 3 [root@bogon local] cd src
 4 [root@bogon src] 5 redis
 6 [root@bogon src] cd redis
 7 [root@bogon redis] ll
 8 total 292
 9 -rw-r--r--.  1 root root 108806 Jan  1 20:50 00-RELEASENOTES
10 -rw-r--r--.  1 root root     51 Jan  1 20:50 BUGS
11 -rw-r--r--.  1 root root   2499 Jan  1 20:50 CONTRIBUTING
12 -rw-r--r--.  1 root root   1487 Jan  1 20:50 COPYING
13 drwxr-xr-x.  6 root root    192 Jan  1 21:00 deps
14 -rw-r--r--.  1 root root     11 Jan  1 20:50 INSTALL
15 -rw-r--r--.  1 root root    151 Jan  1 20:50 Makefile
16 -rw-r--r--.  1 root root   6888 Jan  1 20:50 MANIFESTO
17 -rw-r--r--.  1 root root  21099 Jan  1 20:50 README.md
18 -rw-r--r--.  1 root root  84841 Jan  1 20:50 redis.conf
19 -rwxr-xr-x.  1 root root    275 Jan  1 20:50 runtest
20 -rwxr-xr-x.  1 root root    280 Jan  1 20:50 runtest-cluster
21 -rwxr-xr-x.  1 root root    795 Jan  1 20:50 runtest-moduleapi
22 -rwxr-xr-x.  1 root root    281 Jan  1 20:50 runtest-23 -rw-r--r--.  1 root root  10744 Jan  1 20:50 sentinel.conf
24 drwxr-xr-x.  3 root root   8192 Jan  1 21:11 src
25 drwxr-xr-x. 11 root root    182 Jan  1 20:50 tests
26 -rw-r--r--.  1 root root   3055 Jan  1 20:50 TLS.md
27 drwxr-xr-x.  9 root root   4096 Jan  1 20:50 utils
28 [root@bogon redis] cp redis.conf /root/myredis
View Code

10. 复制成功后,到/root/myredis进行查看,如下所示:

 Redis启动

切换到usr/local/redis/bin目录,通过命令【./redis-server /root/myredis/redis.conf】进行启动,启动成功后,如下所示:

redis默认的窗口是前台显示,不可以关闭的,需要重新打开一个窗口,通过redis客户端【/usr/local/redis/bin/redis-cli】进行访问。如下所示:

通过按Ctrl+C,可以关闭redis打开的服务端窗口,返回命令窗口,如下所示:

修改Redis为后台运行

redis默认为窗口运行,一旦关闭,则停止,可以通过修改配置文件/root/myredis/redis.conf,使redis后台运行,如下所示:

关于Linux下如何修改文件,可参考上一篇博文。

重新启动redis,则以守护进程运行,如下所示:

查看Redis进程

通过命令【ps -ef|grep redis】查看redis相关进程,如下所示:

 Redis关闭服务

通过命令【./redis-cli shutdown】关闭redis服务,如下所示:

 以上就是Redis的下载,安装,启动,关闭的整个流程。

编译异常处理

如果在编译redis的过程中,出现如下错误,则表示gcc版本太低,需要升级。错误如下所示:

如果以上错误,需要执行三个命令进行升级,如下所示:

yum -y install centos-release-scl

yum -y install devtoolset-9-gcc devtoolset-g-gcc-c++ devtoolset-9-binutils

scl enable devtoolset-9 bash

执行过程,如下所示:

  1 [root@bogon redis] yum -y install centos-release-scl
  2 Loaded plugins: fastestmirror,langpacks
  3 Loading mirror speeds from cached hostfile
  4  * base: mirrors.163.com
  5  * extras: mirrors.aliyun.com
  6  * updates: mirrors.aliyun.com
  7 Resolving Dependencies
  8 --> Running transaction check
  9 ---> Package centos-release-scl.noarch 0:2-3.el7.centos will be installed
 10 --> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-3.el7.centos.noarch
 11 --> 12 ---> Package centos-release-scl-rh.noarch 0:2-3 13 --> Finished Dependency Resolution
 14 
 15 Dependencies Resolved
 16 
 17 ===========================================================================================================
 18  Package                           Arch               Version                     Repository          Size
 19 ===========================================================================================================
 20 Installing:
 21  centos-release-scl                noarch             2-3.el7.centos              extras              12 k
 22 Installing  dependencies:
 23  centos-release-scl-rh             noarch             2-3.el7.centos              extras              12 24 
 25 Transaction Summary
 26 ===========================================================================================================
 27 Install  1 Package (+1 Dependent package)
 28 
 29 Total download size: 24 30 Installed size: 39 31 Downloading packages:
 32 (1/2): centos-release-scl-2-3.el7.centos.noarch.rpm                                 |  12 kB  00:00:02     
 33 (2/2): centos-release-scl-rh-2-3.el7.centos.noarch.rpm                              |  12 kB  00:00:02     
 34 -----------------------------------------------------------------------------------------------------------
 35 Total                                                                      8.8 kB/s |  24 kB  00:00:02     
 36 Running transaction check
 37 Running transaction test
 38 Transaction test succeeded
 39 Running transaction
 40   Installing : centos-release-scl-rh-2-3.el7.centos.noarch                                             1/2 
 41   Installing : centos-release-scl-2-3.el7.centos.noarch                                                2/2 
 42   Verifying  : centos-release-scl-2-3.el7.centos.noarch                                                1/2 
 43   Verifying  : centos-release-scl-rh-2-3.el7.centos.noarch                                             2/2 
 44 
 45 Installed:
 46   centos-release-scl.noarch 0:2-3.el7.centos                                                               
 47 
 48 Dependency Installed:
 49   centos-release-scl-rh.noarch 0:2-3.el7.centos                                                            
 50 
 51 Complete!
 52 [root@bogon redis] yum -y install devtoolset-9-gcc devtoolset-g-gcc-c++ devtoolset-9-binutils
 53  54  55  * base: mirrors.163 56  * centos-sclo-rh: mirrors.163 57  * centos-sclo-sclo: mirrors.163 58  * 59  * 60 No package devtoolset-g-gcc-c++ available.
 61  62 --> 63 ---> Package devtoolset-9-binutils.x86_64 0:2.32-16.el7 will be installed
 64 --> Processing Dependency: devtoolset-9-runtime for package: devtoolset-9-binutils-2.32-16.el7.x86_64
 65 ---> Package devtoolset-9-gcc.x86_64 0:9.3.1-2 66 --> 67 ---> Package devtoolset-9-runtime.x86_64 0:9.1-0 68 --> 69 
 70  71 
 72 ===========================================================================================================
 73  Package                          Arch              Version                Repository                 Size
 74 ===========================================================================================================
 75  76  devtoolset-9-binutils            x86_64            2.32-16.el7            centos-sclo-rh            5.9 M
 77  devtoolset-9-gcc                 x86_64            9.3.1-2.el7            centos-sclo-rh             32 78 Installing  79  devtoolset-9-runtime             x86_64            9.1-0.el7              centos-sclo-rh             20 80 
 82 ===========================================================================================================
 83 Install  2 Packages (+1 84 
 85 Total download size: 38 86 Installed size: 100 88 warning: /var/cache/yum/x86_64/7/centos-sclo-rh/packages/devtoolset-9-runtime-9.1-0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature,key ID f2ee9d55: NOKEY
 89 Public key for devtoolset-9-runtime-9.1-0.el7.x86_64.rpm is not installed
 90 (1/3): devtoolset-9-runtime-9.1-0.el7.x86_64.rpm                                    |  20 kB  00:00:02     
 91 (2/3): devtoolset-9-binutils-2.32-16.el7.x86_64.rpm                                 | 5.9 MB  00:00:34     
 92 (3/3): devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm                                      |  32 MB  00:01:57     
 93 -----------------------------------------------------------------------------------------------------------
 94 Total                                                                      328 kB/s |  38 MB  00:01:57     
 95 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
 96 Importing GPG key 0xF2EE9D55:
 97  Userid     : CentOS SoftwareCollections SIG (https://wiki.centos.org/SpecialInterestGroup/SCLo) <security@centos.org> 98  Fingerprint: c4db d535 b1fb ba14 f8ba 64a8 4eb8 4e71 f2ee 9d55
 99  Package    : centos-release-scl-rh-2-3.el7.centos.noarch (@extras)
100  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-101 102 105   Installing : devtoolset-9-runtime-9.1-0.el7.x86_64                                                   1/3 
106   Installing : devtoolset-9-binutils-2.32-16.el7.x86_64                                                2/3 
107   Installing : devtoolset-9-gcc-9.3.1-2.el7.x86_64                                                     3/3 
108   Verifying  : devtoolset-9-gcc-9.3.1-2.el7.x86_64                                                     1/3 
109   Verifying  : devtoolset-9-binutils-2.32-16.el7.x86_64                                                2/3 
110   Verifying  : devtoolset-9-runtime-9.1-0.el7.x86_64                                                   3/3 
111 
112 113   devtoolset-9-binutils.x86_64 0:2.32-16.el7             devtoolset-9-gcc.x86_64 0:9.3.1-2.el7            
114 
115 116   devtoolset-9-runtime.x86_64 0:9.1-0.el7                                                                  
117 
118 Complete!
119 [root@bogon redis] scl enable devtoolset-9 bash
View Code

备注

冬夜读书示子聿(yù)

陆游 〔宋代〕

古人学问无遗力,少壮工夫老始成。
纸上得来终觉浅,绝知此事要躬行。 

原文地址:https://www.cnblogs.com/hsiang

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


文章浏览阅读1.3k次。在 Redis 中,键(Keys)是非常重要的概念,它们代表了存储在数据库中的数据的标识符。对键的有效管理和操作是使用 Redis 数据库的关键一环,它直接影响到数据的存取效率、系统的稳定性和开发的便利性。本文将深入探讨 Redis 中键的管理和操作,包括键的命名规范、常用的键操作命令以及一些最佳实践。我们将详细介绍如何合理命名键、如何使用键的过期和持久化特性、如何批量删除键等技巧,旨在帮助读者更好地理解并灵活运用 Redis 中的键,从而提高数据管理和操作的效率和可靠性。
文章浏览阅读3.3k次,点赞44次,收藏88次。本篇是对单节点的应用,但从中我们也能推断出一些关于集群的应用,不过大多数公司能搞个主从就已经是不错了,所以你能学会这个已经算是很有用了,关于ES,博主前面也讲过一些基础应用,创建一个工具类利用ES的数据模型进行存储就可以达到一个canal同时对Redis和ES的同步,如果担心出问题,可以把Canal搞成集群的形式,这个后续有时间博主再给大家做讲解。今天就到这里了,觉得不错就支持一下吧。_canal redis
文章浏览阅读8.4k次,点赞8次,收藏18次。Spring Boot 整合Redis实现消息队列,RedisMessageListenerContainer的使用,Pub/Sub模式的优缺点_springboot redis 消息队列
文章浏览阅读978次,点赞25次,收藏21次。在Centos上安装Redis5.0保姆级教程!_centos7 安装redis5.0服务器
文章浏览阅读1.2k次,点赞21次,收藏22次。Docker-Compose部署Redis(v7.2)主从模式首先需要有一个redis主从集群,才能接着做redis哨兵模式。_warning: sentinel was not able to save the new configuration on disk!!!: dev
文章浏览阅读2.2k次,点赞59次,收藏38次。合理的JedisPool资源池参数设置能为业务使用Redis保驾护航,本文将对JedisPool的使用、资源池的参数进行详细说明,最后给出“最合理”配置。_jedispool资源池优化
文章浏览阅读1.9k次。批量删除指定前缀的Key有两中方法,一种是借助 redis-cli,另一种是通过 SCAN命令来遍历所有匹配前缀的 key,并使用 DEL命令逐个删除它们。_redis删除前缀的key
文章浏览阅读890次,点赞18次,收藏20次。1. Redis时一个key-cakye的数据库,key一般是String类型,不过value类型有很多。eg.String Hash List Set SortedSet (基本) | GEO BitMap HyperLog (特殊)2.Redis为了方便学习,将操作不同类型的命令做了分组,在官网可以进行查询。
文章浏览阅读1.1k次,点赞19次,收藏26次。若不使用Redisson,而是用synchronized(this),此时会造成对服务器的加锁,若开始大量查询ID为1的商品,每台机器都会先跑一遍加个锁,然后在查询ID为2的数据,此时需要等待ID为1的锁释放,所以需要将this对象调整为全局商品ID。若在执行bgsave命令时,还有其他redis命令被执行(主线程数据修改),此时会对数据做个副本,然后bgsave命令执行这个副本数据写入rdb文件,此时主线程还可以继续修改数据。在当前redis目录下会生成aof文件,对redis修改数据的命令进行备份。
文章浏览阅读1.5k次,点赞39次,收藏24次。本文全面剖析Redis集群在分布式环境下的数据一致性问题,从基础原理到高级特性,涵盖主从复制、哨兵模式、持久化策略等关键点,同时也分享了关于监控、故障模拟与自适应写一致性策略的实践经验。_redis集群一致性
文章浏览阅读1k次。RDB因为是二进制文件,在保存的时候体积也是比较小的,它恢复的比较快,但是它有可能会丢数据,我们通常在项目中也会使用AOF来恢复数据,虽然AOF恢复的速度慢一些,但是它丢数据的风险要小很多,在AOF文件中可以设置刷盘策略,我们当时设置的就是每秒批量写入一次命令。AOF的含义是追加文件,当redis操作写命令的时候,都会存储这个文件中,当redis实例宕机恢复数据的时候,会从这个文件中再次执行一遍命令来恢复数据。:在Redis中提供了两种数据持久化的方式:1、RDB 2、AOF。
文章浏览阅读1k次,点赞24次,收藏21次。NoSQL(No only SQL)数据库,泛指非关系型数据库,实现对于传统数据库而言的。NoSQL 不依赖业务逻辑方式进行存储,而以简单的 key-value 模式存储。因此大大增加了数据库的扩展能力。不遵循SQL标准不支持ACID远超于SQL的性能Redis是当前比较热门的NOSQL系统之一,它是一个开源的使用ANSI c语言编写的key-value存储系统(区别于MySQL的二维表格的形式存储。
文章浏览阅读988次,点赞17次,收藏19次。在上面的步骤中,我们已经开启了 MySQL 的远程访问功能,但是,如果使用 MySQL 管理工具 navicat 连接 MySQL 服务端时,还是可能会出现连接失败的情况。在实际工作中,如果我们需要从其他地方访问和管理 MySQL 数据库,就需要开启 MySQL 的远程访问功能并设置相应的权限。这对于我们的工作效率和数据安全都有很大的帮助。通过查看 MySQL 用户表,我们可以看到’host’为’%’,说明 root 用户登录 MySQL 的时候,可以允许任意的 IP 地址访问 MySQL 服务端。
文章浏览阅读956次。Redis Desktop Manager(RDM)是一款用于管理和操作Redis数据库的图形化界面工具。提供了简单易用的界面,使用户能够方便地执行各种Redis数据库操作,并且支持多个Redis服务器的连接_redisdesktopmanager安装包
文章浏览阅读1.9k次,点赞52次,收藏27次。缓存击穿指的是数据库有数据,缓存本应该也有数据,但是缓存过期了,Redis 这层流量防护屏障被击穿了,请求直奔数据库。缓存穿透指的是数据库本就没有这个数据,请求直奔数据库,缓存系统形同虚设。缓存雪崩指的是大量的热点数据无法在 Redis 缓存中处理(大面积热点数据缓存失效、Redis 宕机),流量全部打到数据库,导致数据库极大压力。
文章浏览阅读1.2k次。一次命令时间(borrow|return resource + Jedis执行命令(含网络) )的平均耗时约为1ms,一个连接的QPS大约是1000,业务期望的QPS是50000,那么理论上需要的资源池大小是50000 / 1000 = 50个,实际maxTotal可以根据理论值合理进行微调。JedisPool默认的maxTotal=8,下面的代码从JedisPool中借了8次Jedis,但是没有归还,当第9次(jedisPool.getResource().ping())3、发生异常可能的情况。_redis.clients.jedis.exceptions.jedisconnectionexception: could not get a res
文章浏览阅读1k次,点赞27次,收藏18次。在这篇文章中,你将了解到如何在 CentOS 系统上安装 Redis 服务,并且掌握通过自定义域名来访问 Redis 服务的技巧。通过使用自定义域名,你可以方便地管理和访问你的 Redis 数据库,提高工作效率。无论你是开发者、系统管理员还是对 Redis 感兴趣的读者,这篇文章都会为你提供清晰的指导和实用的技巧。阅读本文,轻松搭建自己的 Redis 服务,并体验自定义域名带来的便捷!_redis怎么自定义域名
文章浏览阅读1.1k次,点赞15次,收藏18次。我们post请求,拦截器要预先读取HtppServletRequest里面的body的数据,是通过io的方式,都知道io读取完毕之后,之前的数据是变为null的,但是,当我么后面的接口来委派的时候,也是通过io读取body。我们要考虑一个事情,就是我们要验证数据的重复提交: 首先第一次提交的数据肯定是要被存储的,当而第二次往后,每次提交数据都会与之前的数据产生比对从而验证数据重复提交,我们要具体判断数据是否重复提交的子类。发现数据是成功存入的,剩余7s过期,在10s之内,也就是数据没过期之前,在发送一次。_json.parseobject(str, clazz, auto_type_filter);
文章浏览阅读3.9k次,点赞3次,收藏7次。PHP使用Redis实战实录系列:我们首先检查$redis->connect()方法的返回值来确定是否成功连接到Redis服务器。如果连接失败,我们可以输出相应的错误信息。如果连接成功,我们再执行一些操作,如$redis->set()、$redis->get()等,并检查每个操作的返回结果来判断是否发生了异常。_php redis
文章浏览阅读1.5w次,点赞23次,收藏51次。Redis(Remote Dictionary Server ),即远程字典服务,是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。Redis 是一个高性能的key-value数据库。redis的出现,很大程度补偿了memcached这类key/value存储的不足,在部 分场合可以对关系数据库起到很好的补充作用。_redisdesktopmanager下载