redis支持各种不同方式的排序,使用redis凯时app

  1. [root@md03 ~]# redis-cli -a elain 
  2. redis 127.0.0.1:6379> set elain 123456 
  3. OK 
  4. redis 127.0.0.1:6379> get elain 
  5. "123456" 

# Memory

role:master

used_cpu_user_children:0.00

repl_backlog_first_byte_offset:0

主从同步配置:
只需把/etc/redis.conf 复制到 从机上,主、从机上把127.0.0.1 IP 改成本机ip,然后在从机上的redis.conf 里添加以下几行,重启即可:

# Clients

redis官网地址:

  1. vi /etc/redis.conf 

used_memory:815912

/usr/local/redis-2.8.3/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'

测试:

 

keyspace_hits:1

  1. cd /root/tools 
  2. wget  
  3. tar zxvf redis-2.4.2.tar.gz 
  4. cd redis-2.4.2 
  5. make && make install 
  6. cp redis.conf  /etc/ 
  7. cd 

uptime_in_seconds:6

used_memory_lua:22528

注:以上主从配置做了密码验证,也可不做验证,不用加masterauth 选项

 (    '      ,       .-`  | `,    )     Running in standalone mode

**********

  1. echo "redis-server /etc/redis.conf" >>/etc/rc.local 

# Cluster

collect2: ld returned 1 exit status

简述:Redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)和zset(有序集合)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。

#tar -zxvf redis-3.0.5.tar.gz

-rwxr-xr-x. 1 root root 4229443 Jan 1 23:27 redis-cli

启动:

redis_version:3.0.7

redis是当前比较热门的NOSQL系统之一,它是一个key-value存储系统。

  1. redis-server /etc/redis.conf 

total_connections_received:1

包括string、list、set、zset和hash。

process_id:7226

keyspace_misses:0

开机加自启动:

sync_partial_err:0

expired_keys:0

下载安装:

[1] 7226

LINK redis-server

  1. daemonize yes 
  2. pidfile /var/run/redis.pid 
  3. port 6379 
  4.  
  5. #bind 127.0.0.1 
  6. timeout 600 
  7. loglevel notice 
  8. logfile /elain/logs/redis/redis.log 
  9.  
  10. databases 16 
  11.  
  12. save 900 1 
  13. save 300 10 
  14. save 60 10000 
  15.  
  16. rdbcompression yes 
  17. dbfilename dump.rdb 
  18.  
  19. dir /elain/data/redis/ 
  20.  
  21. # maxclients 128 
  22.  
  23. appendonly yes 
  24. appendfilename appendonly.aof 
  25.  
  26. # appendfsync always 
  27. appendfsync everysec 
  28. # appendfsync no 
  29.  
  30. requirepass elain 
  31.  
  32. no-appendfsync-on-rewrite no 
  33. auto-aof-rewrite-percentage 100 
  34. auto-aof-rewrite-min-size 64mb 
  35.  
  36. slowlog-log-slower-than 10000 
  37.  
  38. slowlog-max-len 1024 
  39.  
  40. really-use-vm yes 
  41. vm-enabled yes 
  42. vm-swap-file /tmp/redis.swap 
  43. vm-max-memory 0 
  44. vm-page-size 32 
  45. vm-pages 134217728 
  46. vm-max-threads 4 
  47.  
  48. hash-max-zipmap-entries 512 
  49. hash-max-zipmap-value 64 
  50.  
  51. list-max-ziplist-entries 512 
  52. list-max-ziplist-value 64 
  53.  
  54. set-max-intset-entries 512 
  55.  
  56. zset-max-ziplist-entries 128 
  57. zset-max-ziplist-value 64 
  58.  
  59. activerehashing yes 
  60.  
  61. # include /path/to/local.conf 
  62. # include /path/to/other.conf 

 |    `-._`-._        _.-'_.-'    |                                 

redis_version:2.8.3

凯时app 1

rejected_connections:0

redis-2.8.3.tar.gz文件下载成功后上传至/usr/local

查看状态信息:

 

|    `-._`-._        _.-'_.-'    |

  1. slave-serve-stale-data yes 
  2. slaveof 主服务器IP 6379 
  3. masterauth <master-password> 

7226:M 13 Apr 02:06:13.826 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

rdb_changes_since_last_save:0

  1. [root@md04 ~]# redis-cli info 
  2. redis_version:2.4.2 
  3. redis_git_sha1:00000000 
  4. redis_git_dirty:0 
  5. arch_bits:64 
  6. multiplexing_api:epoll 
  7. process_id:2204 
  8. uptime_in_seconds:25 
  9. uptime_in_days:0 
  10. lru_clock:2013834 
  11. used_cpu_sys:0.00 
  12. used_cpu_user:0.00 
  13. used_cpu_sys_children:0.00 
  14. used_cpu_user_children:0.00 
  15. connected_clients:1 
  16. connected_slaves:0 
  17. client_longest_output_list:0 
  18. client_biggest_input_buf:0 
  19. blocked_clients:0 
  20. used_memory:17505392 
  21. used_memory_human:16.69M 
  22. used_memory_rss:1617920 
  23. used_memory_peak:17496792 
  24. used_memory_peak_human:16.69M 
  25. mem_fragmentation_ratio:0.09 
  26. mem_allocator:jemalloc-2.2.1 
  27. loading:0 
  28. aof_enabled:1 
  29. changes_since_last_save:5 
  30. bgsave_in_progress:0 
  31. last_save_time:1320372561 
  32. bgrewriteaof_in_progress:0 
  33. total_connections_received:1 
  34. total_commands_processed:0 
  35. expired_keys:0 
  36. evicted_keys:0 
  37. keyspace_hits:2 
  38. keyspace_misses:8 
  39. pubsub_channels:0 
  40. pubsub_patterns:0 
  41. latest_fork_usec:0 
  42. vm_enabled:1 
  43. role:master 
  44. aof_current_size:237 
  45. aof_base_size:237 
  46. aof_pending_rewrite:0 
  47. vm_conf_max_memory:0 
  48. vm_conf_page_size:32 
  49. vm_conf_pages:134217728 
  50. vm_stats_used_pages:3 
  51. vm_stats_swapped_objects:3 
  52. vm_stats_swappin_count:0 
  53. vm_stats_swappout_count:3 
  54. vm_stats_io_newjobs_len:0 
  55. vm_stats_io_processing_len:0 
  56. vm_stats_io_processed_len:0 
  57. vm_stats_io_active_threads:0 
  58. vm_stats_blocked_clients:0 
  59. db0:keys=4,expires=0 

 

cmdstat_monitor:calls=1,usec=6,usec_per_call=6.00

环境:CentOS 5.5  x64

 |    `-._   `._    /     _.-'    |     PID: 7226

经查询,执行 make 时加上参数 CFLAGS="-march=i686"即可通过make这个步骤,

config_file:

used_cpu_user_children:0.00

 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

used_cpu_sys_children:0.00

expired_keys:0

used_memory_human:617.89K

              `-.__.-'                                               

rdb_last_bgsave_time_sec:0

# CPU

`-._        _.-'

arch_bits:64

# Replication

OK

[13112] 05 Mar 19:45:48.251 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.

loading:0

repl_backlog_size:1048576

rdb_current_bgsave_time_sec:-1

我用rhel5.2的

used_memory_rss:7983104

|`-._`-._    `-.__.-'    _.-'_.-'|

connected_slaves:0

5、然后用客户端测试一下是否启动成功。(新开一个终端运行下面的命令)

redis_mode:standalone

run_id:7d748a79804140a4c0f06b7196ce601c4958aab4

total_net_input_bytes:14

[13112] 05 Mar 19:45:48.254 # 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.

blocked_clients:0

os:Linux 2.6.18-194.el5 i686

           _.-``__ ''-._                                             

lru_clock:2077243

7226:M 13 Apr 02:06:13.826 # 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.

used_cpu_sys:1.89

repl_backlog_size:1048576

make[1]: Entering directory `/usr/local/redis-2.8.3/src'

aof_last_write_status:ok

`-._    `-._  `-./  _.-'    _.-'

                _._                                                 

used_memory_peak:631776

repl_backlog_first_byte_offset:0

make[1]: Leaving directory `/usr/local/src/redis-2.8.3/src'

 

aof_rewrite_in_progress:0

aof_last_bgrewrite_status:ok

2、安装

 

total 13688

 

3、编译完成后,在Src目录下,有三个可执行文件redis-server、redis-benchmark、redis-cli。然后拷贝到一个目录下。

sync_full:0

例子:用java程序,编写程序,定时用ssh的方式连接redis所在的linux服务器,然后进行指定命令的执行,

used_memory_lua:36864

rdb_last_save_time:1488775549

hz:10

repl_backlog_active:0

[root@ELK2 redis]# 7226:C 13 Apr 02:06:13.822 # Warning: no config file specified, using the default config. In order to specify a config file use ./bin/redis-server /path/to/redis.conf

[root@bogon redis]# ./redis-cli

rdb_bgsave_in_progress:0

used_memory_peak_human:616.97K

7226:M 13 Apr 02:06:13.826 * The server is now ready to accept connections on port 6379

6、客户端利用SSH执行命令获取相关指标信息

used_memory_peak_human:796.79K

used_memory:632720

 

config_file:

used_memory_peak:815912

在此基础上,redis支持各种不同方式的排序。

rdb_last_bgsave_time_sec:-1

aof_last_bgrewrite_status:ok

total_commands_processed:0

total_commands_processed:7

查看远程Redis服务器的版本:bin/redis-cli -h 192.168.1.111 info

aof_enabled:0

# Replication

cmdstat_info:calls=2,usec=2316,usec_per_call=1158.00

role:master

pubsub_channels:0

本文由凯时app发布于计算机网络,转载请注明出处:redis支持各种不同方式的排序,使用redis凯时app

TAG标签:
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。