首页 > 代码库 > CentOS 7 安装Redis 2.8.7
CentOS 7 安装Redis 2.8.7
1、下载软件:
wget wget http://download.redis.io/releases/redis-2.8.7.tar.gz
2、解压软件并编译安装:
tar -zxvf redis-2.8.7.tar.gz
mv redis-2.8.7.tar.gz redis
cd redis
make&&make install
等待编译一端时间即可(如果您的机器上没有c++编译环境,可以通过yum安装 gcc ,命令:yum -y install gcc)
cd src
启动redis-server:./redis-server ../redis.conf
启动会发送警告:
[16403] 12 Dec 21:55:32.830 # 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.
安装提示,解决上述问题。默认的情况下,redis监听6379端口。
3、测试使用redis #使用 telnet
[likehua@localhost local]$ telnet localhost 6379Trying ::1...Connected to localhost.Escape character is ‘^]‘.set likehua likehua+OKget likehua$7likehua
4、使用redis-benchmark对redis可以进行简单的性能测试。
1 [likehua@localhost src]$ ./redis-benchmark -h localhost -p 6379 -c 1000 -n 100000 2 ====== PING_INLINE ====== 3 100000 requests completed in 2.03 seconds 4 1000 parallel clients 5 3 bytes payload 6 keep alive: 1 7 8 0.00% <= 8 milliseconds 9 0.04% <= 9 milliseconds 10 66.42% <= 10 milliseconds 11 88.10% <= 11 milliseconds 12 91.29% <= 12 milliseconds 13 93.57% <= 13 milliseconds 14 96.30% <= 14 milliseconds 15 98.13% <= 15 milliseconds 16 98.78% <= 16 milliseconds 17 99.37% <= 17 milliseconds 18 99.77% <= 18 milliseconds 19 99.93% <= 19 milliseconds 20 99.97% <= 20 milliseconds 21 100.00% <= 20 milliseconds 22 49333.99 requests per second 23 24 ====== PING_BULK ====== 25 100000 requests completed in 1.98 seconds 26 1000 parallel clients 27 3 bytes payload 28 keep alive: 1 29 30 0.00% <= 6 milliseconds 31 0.01% <= 7 milliseconds 32 0.15% <= 8 milliseconds 33 15.79% <= 9 milliseconds 34 58.19% <= 10 milliseconds 35 92.03% <= 11 milliseconds 36 96.30% <= 12 milliseconds 37 98.24% <= 13 milliseconds 38 98.90% <= 14 milliseconds 39 99.30% <= 15 milliseconds 40 99.63% <= 16 milliseconds 41 99.99% <= 17 milliseconds 42 100.00% <= 17 milliseconds 43 50581.69 requests per second 44 45 ====== SET ====== 46 100000 requests completed in 2.00 seconds 47 1000 parallel clients 48 3 bytes payload 49 keep alive: 1 50 51 0.00% <= 7 milliseconds 52 0.24% <= 8 milliseconds 53 6.78% <= 9 milliseconds 54 62.14% <= 10 milliseconds 55 88.33% <= 11 milliseconds 56 93.36% <= 12 milliseconds 57 96.28% <= 13 milliseconds 58 97.19% <= 14 milliseconds 59 98.11% <= 15 milliseconds 60 98.58% <= 16 milliseconds 61 98.91% <= 17 milliseconds 62 99.49% <= 18 milliseconds 63 99.84% <= 19 milliseconds 64 100.00% <= 19 milliseconds 65 49900.20 requests per second 66 67 ====== GET ====== 68 100000 requests completed in 1.97 seconds 69 1000 parallel clients 70 3 bytes payload 71 keep alive: 1 72 73 0.00% <= 5 milliseconds 74 0.01% <= 6 milliseconds 75 0.24% <= 7 milliseconds 76 9.30% <= 8 milliseconds 77 35.68% <= 9 milliseconds 78 53.22% <= 10 milliseconds 79 80.98% <= 11 milliseconds 80 95.27% <= 12 milliseconds 81 97.05% <= 13 milliseconds 82 98.47% <= 14 milliseconds 83 99.40% <= 15 milliseconds 84 99.76% <= 16 milliseconds 85 99.94% <= 17 milliseconds 86 100.00% <= 17 milliseconds 87 50813.01 requests per second 88 89 ====== INCR ====== 90 100000 requests completed in 2.01 seconds 91 1000 parallel clients 92 3 bytes payload 93 keep alive: 1 94 95 0.00% <= 6 milliseconds 96 0.03% <= 7 milliseconds 97 0.26% <= 8 milliseconds 98 10.85% <= 9 milliseconds 99 51.33% <= 10 milliseconds100 86.53% <= 11 milliseconds101 91.05% <= 12 milliseconds102 93.84% <= 13 milliseconds103 97.30% <= 14 milliseconds104 99.09% <= 15 milliseconds105 99.78% <= 16 milliseconds106 99.93% <= 17 milliseconds107 100.00% <= 17 milliseconds108 49825.61 requests per second109 110 ====== LPUSH ======111 100000 requests completed in 1.98 seconds112 1000 parallel clients113 3 bytes payload114 keep alive: 1115 116 0.00% <= 6 milliseconds117 0.77% <= 7 milliseconds118 2.36% <= 8 milliseconds119 11.40% <= 9 milliseconds120 53.46% <= 10 milliseconds121 90.92% <= 11 milliseconds122 96.49% <= 12 milliseconds123 98.51% <= 13 milliseconds124 99.33% <= 14 milliseconds125 99.82% <= 15 milliseconds126 99.91% <= 16 milliseconds127 100.00% <= 17 milliseconds128 100.00% <= 17 milliseconds129 50479.56 requests per second130 131 ====== LPOP ======132 100000 requests completed in 1.97 seconds133 1000 parallel clients134 3 bytes payload135 keep alive: 1136 137 0.00% <= 6 milliseconds138 1.08% <= 7 milliseconds139 8.16% <= 8 milliseconds140 22.76% <= 9 milliseconds141 54.23% <= 10 milliseconds142 86.55% <= 11 milliseconds143 96.52% <= 12 milliseconds144 98.67% <= 13 milliseconds145 99.56% <= 14 milliseconds146 99.83% <= 15 milliseconds147 99.92% <= 16 milliseconds148 100.00% <= 16 milliseconds149 50735.67 requests per second150 151 ====== SADD ======152 100000 requests completed in 2.01 seconds153 1000 parallel clients154 3 bytes payload155 keep alive: 1156 157 0.00% <= 6 milliseconds158 0.00% <= 7 milliseconds159 0.20% <= 8 milliseconds160 3.06% <= 9 milliseconds161 74.43% <= 10 milliseconds162 91.78% <= 11 milliseconds163 95.16% <= 12 milliseconds164 96.61% <= 13 milliseconds165 97.22% <= 14 milliseconds166 98.35% <= 15 milliseconds167 99.45% <= 16 milliseconds168 100.00% <= 16 milliseconds169 49751.24 requests per second170 171 ====== SPOP ======172 100000 requests completed in 1.98 seconds173 1000 parallel clients174 3 bytes payload175 keep alive: 1176 177 0.00% <= 6 milliseconds178 0.25% <= 7 milliseconds179 9.22% <= 8 milliseconds180 27.89% <= 9 milliseconds181 51.53% <= 10 milliseconds182 83.58% <= 11 milliseconds183 95.62% <= 12 milliseconds184 98.06% <= 13 milliseconds185 99.22% <= 14 milliseconds186 99.83% <= 15 milliseconds187 99.86% <= 16 milliseconds188 99.90% <= 17 milliseconds189 99.93% <= 18 milliseconds190 99.97% <= 19 milliseconds191 100.00% <= 19 milliseconds192 50530.57 requests per second193 194 ====== LPUSH (needed to benchmark LRANGE) ======195 100000 requests completed in 2.01 seconds196 1000 parallel clients197 3 bytes payload198 keep alive: 1199 200 0.00% <= 6 milliseconds201 0.08% <= 7 milliseconds202 0.32% <= 8 milliseconds203 5.15% <= 9 milliseconds204 51.92% <= 10 milliseconds205 91.54% <= 11 milliseconds206 94.53% <= 12 milliseconds207 96.95% <= 13 milliseconds208 98.08% <= 14 milliseconds209 98.76% <= 15 milliseconds210 99.68% <= 16 milliseconds211 100.00% <= 16 milliseconds212 49652.43 requests per second213 214 ====== LRANGE_100 (first 100 elements) ======215 100000 requests completed in 4.00 seconds216 1000 parallel clients217 3 bytes payload218 keep alive: 1219 220 0.00% <= 14 milliseconds221 4.44% <= 15 milliseconds222 23.32% <= 16 milliseconds223 26.30% <= 17 milliseconds224 27.43% <= 18 milliseconds225 28.36% <= 19 milliseconds226 28.98% <= 20 milliseconds227 32.42% <= 21 milliseconds228 74.49% <= 22 milliseconds229 89.15% <= 23 milliseconds230 95.46% <= 24 milliseconds231 95.91% <= 25 milliseconds232 96.45% <= 26 milliseconds233 97.53% <= 27 milliseconds234 98.42% <= 28 milliseconds235 98.79% <= 29 milliseconds236 98.95% <= 30 milliseconds237 99.15% <= 31 milliseconds238 99.30% <= 32 milliseconds239 99.42% <= 33 milliseconds240 99.53% <= 34 milliseconds241 99.60% <= 35 milliseconds242 99.67% <= 36 milliseconds243 99.77% <= 37 milliseconds244 99.94% <= 38 milliseconds245 100.00% <= 38 milliseconds246 25006.25 requests per second247 248 ====== LRANGE_300 (first 300 elements) ======249 100000 requests completed in 6.69 seconds250 1000 parallel clients251 3 bytes payload252 keep alive: 1253 254 0.00% <= 16 milliseconds255 0.01% <= 17 milliseconds256 0.04% <= 18 milliseconds257 0.08% <= 19 milliseconds258 0.11% <= 20 milliseconds259 0.15% <= 21 milliseconds260 0.18% <= 22 milliseconds261 0.22% <= 23 milliseconds262 0.24% <= 24 milliseconds263 0.26% <= 25 milliseconds264 0.29% <= 26 milliseconds265 2.09% <= 27 milliseconds266 8.86% <= 28 milliseconds267 21.91% <= 29 milliseconds268 32.42% <= 30 milliseconds269 47.12% <= 31 milliseconds270 57.70% <= 32 milliseconds271 64.38% <= 33 milliseconds272 68.73% <= 34 milliseconds273 71.52% <= 35 milliseconds274 73.66% <= 36 milliseconds275 75.44% <= 37 milliseconds276 77.48% <= 38 milliseconds277 79.79% <= 39 milliseconds278 81.49% <= 40 milliseconds279 83.05% <= 41 milliseconds280 84.96% <= 42 milliseconds281 86.70% <= 43 milliseconds282 88.68% <= 44 milliseconds283 93.08% <= 45 milliseconds284 95.99% <= 46 milliseconds285 99.41% <= 47 milliseconds286 99.47% <= 48 milliseconds287 99.54% <= 49 milliseconds288 99.59% <= 50 milliseconds289 99.65% <= 51 milliseconds290 99.72% <= 52 milliseconds291 99.78% <= 53 milliseconds292 99.84% <= 54 milliseconds293 99.88% <= 55 milliseconds294 99.90% <= 56 milliseconds295 99.93% <= 57 milliseconds296 99.96% <= 58 milliseconds297 99.99% <= 59 milliseconds298 100.00% <= 59 milliseconds299 14949.92 requests per second300 301 ====== LRANGE_500 (first 450 elements) ======302 100000 requests completed in 8.71 seconds303 1000 parallel clients304 3 bytes payload305 keep alive: 1306 307 0.00% <= 20 milliseconds308 0.02% <= 21 milliseconds309 0.07% <= 22 milliseconds310 0.10% <= 23 milliseconds311 0.13% <= 24 milliseconds312 0.16% <= 25 milliseconds313 0.17% <= 26 milliseconds314 0.18% <= 27 milliseconds315 0.20% <= 28 milliseconds316 0.21% <= 29 milliseconds317 0.22% <= 30 milliseconds318 0.23% <= 31 milliseconds319 0.26% <= 32 milliseconds320 0.34% <= 33 milliseconds321 0.63% <= 34 milliseconds322 3.99% <= 35 milliseconds323 7.57% <= 36 milliseconds324 10.77% <= 37 milliseconds325 13.87% <= 38 milliseconds326 16.86% <= 39 milliseconds327 24.72% <= 40 milliseconds328 40.82% <= 41 milliseconds329 49.31% <= 42 milliseconds330 54.46% <= 43 milliseconds331 60.03% <= 44 milliseconds332 65.25% <= 45 milliseconds333 70.38% <= 46 milliseconds334 74.43% <= 47 milliseconds335 78.07% <= 48 milliseconds336 81.36% <= 49 milliseconds337 84.61% <= 50 milliseconds338 87.36% <= 51 milliseconds339 89.99% <= 52 milliseconds340 92.09% <= 53 milliseconds341 94.16% <= 54 milliseconds342 95.79% <= 55 milliseconds343 96.93% <= 56 milliseconds344 97.84% <= 57 milliseconds345 98.52% <= 58 milliseconds346 98.91% <= 59 milliseconds347 99.26% <= 60 milliseconds348 99.47% <= 61 milliseconds349 99.51% <= 62 milliseconds350 99.53% <= 63 milliseconds351 99.55% <= 64 milliseconds352 99.57% <= 65 milliseconds353 99.61% <= 66 milliseconds354 99.65% <= 67 milliseconds355 99.69% <= 68 milliseconds356 99.73% <= 69 milliseconds357 99.78% <= 70 milliseconds358 99.83% <= 71 milliseconds359 99.86% <= 72 milliseconds360 99.89% <= 73 milliseconds361 99.91% <= 74 milliseconds362 99.93% <= 75 milliseconds363 99.95% <= 76 milliseconds364 99.96% <= 77 milliseconds365 99.98% <= 78 milliseconds366 100.00% <= 78 milliseconds367 11479.74 requests per second368 369 ====== LRANGE_600 (first 600 elements) ======370 100000 requests completed in 11.03 seconds371 1000 parallel clients372 3 bytes payload373 keep alive: 1374 375 0.00% <= 19 milliseconds376 0.01% <= 20 milliseconds377 0.03% <= 21 milliseconds378 0.04% <= 22 milliseconds379 0.05% <= 23 milliseconds380 0.07% <= 24 milliseconds381 0.08% <= 25 milliseconds382 0.09% <= 26 milliseconds383 0.10% <= 27 milliseconds384 0.12% <= 28 milliseconds385 0.12% <= 29 milliseconds386 0.14% <= 30 milliseconds387 0.16% <= 31 milliseconds388 0.20% <= 32 milliseconds389 0.23% <= 33 milliseconds390 0.27% <= 34 milliseconds391 0.29% <= 35 milliseconds392 0.32% <= 36 milliseconds393 0.36% <= 37 milliseconds394 0.39% <= 38 milliseconds395 0.43% <= 39 milliseconds396 0.47% <= 40 milliseconds397 0.50% <= 41 milliseconds398 0.53% <= 42 milliseconds399 0.58% <= 43 milliseconds400 0.74% <= 44 milliseconds401 1.40% <= 45 milliseconds402 4.51% <= 46 milliseconds403 8.98% <= 47 milliseconds404 13.34% <= 48 milliseconds405 18.11% <= 49 milliseconds406 23.27% <= 50 milliseconds407 29.19% <= 51 milliseconds408 34.92% <= 52 milliseconds409 41.34% <= 53 milliseconds410 48.28% <= 54 milliseconds411 55.34% <= 55 milliseconds412 62.15% <= 56 milliseconds413 67.49% <= 57 milliseconds414 71.73% <= 58 milliseconds415 75.33% <= 59 milliseconds416 78.47% <= 60 milliseconds417 81.46% <= 61 milliseconds418 84.14% <= 62 milliseconds419 86.82% <= 63 milliseconds420 89.05% <= 64 milliseconds421 91.05% <= 65 milliseconds422 93.09% <= 66 milliseconds423 94.56% <= 67 milliseconds424 95.60% <= 68 milliseconds425 96.47% <= 69 milliseconds426 97.07% <= 70 milliseconds427 97.55% <= 71 milliseconds428 97.98% <= 72 milliseconds429 98.32% <= 73 milliseconds430 98.57% <= 74 milliseconds431 98.68% <= 75 milliseconds432 98.82% <= 76 milliseconds433 98.91% <= 77 milliseconds434 99.02% <= 78 milliseconds435 99.04% <= 79 milliseconds436 99.05% <= 80 milliseconds437 99.07% <= 81 milliseconds438 99.09% <= 82 milliseconds439 99.10% <= 83 milliseconds440 99.10% <= 84 milliseconds441 99.11% <= 85 milliseconds442 99.12% <= 86 milliseconds443 99.13% <= 87 milliseconds444 99.14% <= 88 milliseconds445 99.16% <= 89 milliseconds446 99.17% <= 90 milliseconds447 99.18% <= 91 milliseconds448 99.20% <= 92 milliseconds449 99.21% <= 93 milliseconds450 99.23% <= 94 milliseconds451 99.25% <= 95 milliseconds452 99.27% <= 96 milliseconds453 99.29% <= 97 milliseconds454 99.30% <= 98 milliseconds455 99.33% <= 99 milliseconds456 99.36% <= 100 milliseconds457 99.39% <= 101 milliseconds458 99.41% <= 102 milliseconds459 99.43% <= 103 milliseconds460 99.46% <= 104 milliseconds461 99.49% <= 105 milliseconds462 99.51% <= 106 milliseconds463 99.54% <= 107 milliseconds464 99.56% <= 108 milliseconds465 99.58% <= 109 milliseconds466 99.61% <= 110 milliseconds467 99.64% <= 111 milliseconds468 99.66% <= 112 milliseconds469 99.68% <= 113 milliseconds470 99.71% <= 114 milliseconds471 99.73% <= 115 milliseconds472 99.76% <= 116 milliseconds473 99.78% <= 117 milliseconds474 99.79% <= 118 milliseconds475 99.80% <= 119 milliseconds476 99.81% <= 120 milliseconds477 99.82% <= 121 milliseconds478 99.83% <= 122 milliseconds479 99.85% <= 123 milliseconds480 99.86% <= 124 milliseconds481 99.87% <= 125 milliseconds482 99.88% <= 126 milliseconds483 99.90% <= 127 milliseconds484 99.92% <= 128 milliseconds485 99.93% <= 129 milliseconds486 99.94% <= 130 milliseconds487 99.94% <= 131 milliseconds488 99.94% <= 132 milliseconds489 99.95% <= 133 milliseconds490 99.95% <= 134 milliseconds491 99.95% <= 135 milliseconds492 99.95% <= 136 milliseconds493 99.95% <= 137 milliseconds494 99.96% <= 138 milliseconds495 99.96% <= 139 milliseconds496 99.96% <= 140 milliseconds497 99.96% <= 141 milliseconds498 99.96% <= 142 milliseconds499 99.97% <= 143 milliseconds500 99.97% <= 144 milliseconds501 99.97% <= 145 milliseconds502 99.99% <= 146 milliseconds503 100.00% <= 146 milliseconds504 9067.83 requests per second505 506 ====== MSET (10 keys) ======507 100000 requests completed in 2.31 seconds508 1000 parallel clients509 3 bytes payload510 keep alive: 1511 512 0.00% <= 9 milliseconds513 0.16% <= 10 milliseconds514 0.33% <= 11 milliseconds515 0.58% <= 12 milliseconds516 1.01% <= 13 milliseconds517 1.33% <= 14 milliseconds518 2.03% <= 15 milliseconds519 2.50% <= 16 milliseconds520 3.43% <= 17 milliseconds521 4.79% <= 18 milliseconds522 6.51% <= 19 milliseconds523 20.35% <= 20 milliseconds524 58.54% <= 21 milliseconds525 69.83% <= 22 milliseconds526 76.45% <= 23 milliseconds527 80.71% <= 24 milliseconds528 84.42% <= 25 milliseconds529 88.26% <= 26 milliseconds530 91.26% <= 27 milliseconds531 92.21% <= 28 milliseconds532 93.89% <= 29 milliseconds533 95.65% <= 30 milliseconds534 96.55% <= 31 milliseconds535 96.96% <= 32 milliseconds536 97.36% <= 33 milliseconds537 97.61% <= 34 milliseconds538 98.07% <= 35 milliseconds539 98.18% <= 36 milliseconds540 98.47% <= 37 milliseconds541 98.84% <= 38 milliseconds542 99.02% <= 39 milliseconds543 99.45% <= 40 milliseconds544 99.63% <= 41 milliseconds545 99.83% <= 42 milliseconds546 99.94% <= 47 milliseconds547 99.97% <= 63 milliseconds548 100.00% <= 63 milliseconds549 43215.21 requests per second
如果不知道怎么使用redis-benchmark就使用redis-benchmark -help命令,它会告诉你它所有的本领!通过,上面的简单性能测试,你会发现redis简直是性能怪兽!这个数字可是在我的一台普通PC机器上测试的!貌似,比公司的数字大很多,具体原因以后分析。
CentOS 7 安装Redis 2.8.7