- 浏览: 1490107 次
- 性别:
- 来自: 北京
-
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
redmon安装
http://www.cr173.com/html/14775_1.html
failover
参考一点http://dmouse.iteye.com/blog/813026
redis支持master-slave模式,可以设置一个master,多个slave;采用读写分离的策略,master负责写数据,多个slave负责读数据,slave的数据是复制master上的,所以多个slave之间的数据是可以保持一致的,即便down了之后,也会通过加载dump数据的方式,重新加载会原来的缓存数据。
Fail-Tolerance
当前项目需要保证一个client连接到slave服务上读取数据,如果slave down 了之后,可以在不影响应用的情况下,自动切换到另外一个可用的slave
因为jredis不支持设置多个slave服务器,所以写了一个小工具类,目的是为了探测如果的当前正在使用的slave没有heartbeat之后,立马可以切换到一个可用的slave;这样可以保证one of slave down掉之后,不用missing-load也可及时切换到另外一个slave上读数据。
改成jedis的
----------------
安装
jredis
https://github.com/alphazero/jredis/downloads
http://liuxinglanyue.iteye.com/blog/829428
参数说明
http://aronlulu.iteye.com/blog/1236773
注意dump.rdb文件
默认在redis-server的同一个目录下
dir指定
官方文档
http://try.redis-db.com/
导出json
https://github.com/delano/redis-dump
--------------
rais的安装
http://archive.cnblogs.com/a/1937602/
http://www.cnblogs.com/watir/archive/2011/01/17/1937602.html
为了装https://github.com/steelThread/redmon
redmon
sqlite3报错
http://blog.toolib.net/cnmahj/2011/09/rails3-1%E4%BD%BF%E7%94%A8sqlite%E6%97%B6%E2%80%9Csqlite3_int64-undeclared%E2%80%9D%E9%94%99%E8%AF%AF%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/
i容量预计和估算
http://blog.nosqlfan.com/html/3430.html
u不过发现脚本执行几次,差值不一样
数据增量存储
http://www.hoterran.info/redis_persistence
源码分析
http://blog.nosqlfan.com/html/2949.html?ref=rediszt
资料总会专题
http://blog.nosqlfan.com/html/3537.html
Redis采用不同内存分配器碎片率对比
http://blog.nosqlfan.com/html/3490.html
目录
http://blog.nosqlfan.com/tags/redis
Redis复制与可扩展集群搭建
http://www.infoq.com/cn/articles/tq-redis-copy-build-scalable-cluster
测试,需要看valgrind
http://blog.nosqlfan.com/html/2383.html
容量
http://timyang.net/data/redis-capacity/
微波两个人
http://weibo.com/bachmozart?key_word=redis
http://weibo.com/tangfl?key_word=redis
lua
http://blog.nosqlfan.com/html/1658.html
ruby的监控
用最新版zlib问题
https://rvm.beginrescueend.com/rvm/install/
http://belmount.blog.51cto.com/1897431/766728
https://blog.johncheng.com/?p=1389
rvm
http://floger.iteye.com/blog/935374
不用openssl
最后那个运行下就行
rvm requirements
rvm install 1.9.3
rvm list
rvm alias create default ruby-1.9.3-p125
gem install bundler
rvm rubygems latest
rvm pkg install openssl
gem install rails
rvm gemset list
看rails的版本,然后
rvm gemset create rails3.2.1
rvm pkg install zlib ;
rvm pkg install readline;
rvm pkg install openssl;
rvm pkg install iconv;
rvm remove 1.9.3;
rvm install 1.9.3 --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr
rvm gemset create rails3.2.1
zlib
https://rvm.beginrescueend.com/packages/zlib/
Ruby 1.9.3-p0 makes psych—the replacement for 1.8.7’s YAML library,
http://www.cnblogs.com/qq78292959/archive/2011/12/15/2288567.html
rvm info
rvm requirements
rvm install 1.8.7
rvm list
rvm alias create default ruby-1.8.7-p358
ruby -v
gem install rails
rvm gemset list
rvm gemset list
rvm gemset create rails3.2.1
gem install jquery-rails
rails new demo1
集群
http://wenku.baidu.com/view/d9ac5ab9960590c69ec37683.html
cassandra
http://baike.baidu.com/view/1350234.htm
2.6 Redis集群功能说明
http://blog.nosqlfan.com/html/3302.html
ppt
http://blog.nosqlfan.com/html/1007.html
hash
http://emreyilmaz.me/implementing-consistent-hashing-into-your-redis
http://www.cr173.com/html/14775_1.html
failover
参考一点http://dmouse.iteye.com/blog/813026
redis支持master-slave模式,可以设置一个master,多个slave;采用读写分离的策略,master负责写数据,多个slave负责读数据,slave的数据是复制master上的,所以多个slave之间的数据是可以保持一致的,即便down了之后,也会通过加载dump数据的方式,重新加载会原来的缓存数据。
Fail-Tolerance
当前项目需要保证一个client连接到slave服务上读取数据,如果slave down 了之后,可以在不影响应用的情况下,自动切换到另外一个可用的slave
因为jredis不支持设置多个slave服务器,所以写了一个小工具类,目的是为了探测如果的当前正在使用的slave没有heartbeat之后,立马可以切换到一个可用的slave;这样可以保证one of slave down掉之后,不用missing-load也可及时切换到另外一个slave上读数据。
public class RedisFailToleranceUtil { private static JRedisService jredisService = null; private static ConnectionSpec defaultConnectionSpec = null; private static int current = 1; private static HashMap<String,ConnectionSpec> serverPools = new HashMap<String,ConnectionSpec>(); static{ ConnectionSpec connectionSpec1 = DefaultConnectionSpec.newSpec("192.168.1.238", 6380, 0,null); ConnectionSpec connectionSpec2 = DefaultConnectionSpec.newSpec("192.168.1.238", 6381, 0,null); serverPools.put("1", connectionSpec1); serverPools.put("2", connectionSpec2); } private String next(){ if(current>serverPools.size()){ current=1; } int nextIndex = current; current++; return nextIndex+""; } private ConnectionSpec getConnectionSpec(){ if(defaultConnectionSpec != null){ return defaultConnectionSpec; } jredisService = null; /** * we are working multiple servers * try different servers,util we fetch the first available server pool */ HashMap<String,ConnectionSpec> tryServers = new HashMap<String,ConnectionSpec>(serverPools); if(serverPools.size() == 1){ return (ConnectionSpec)serverPools.get("1"); } while(!tryServers.isEmpty()){ ConnectionSpec connectionSpec = tryServers.get(this.next()); if(isConnect(connectionSpec)){ return connectionSpec; } tryServers.remove(connectionSpec); if(tryServers.isEmpty()){ break; } } return null; } /** * try whether the server is available * @param connectionSpec * @return true or false */ private boolean isConnect(ConnectionSpec connectionSpec){ if(connectionSpec == null){ return false; } JRedis jredis = new JRedisClient(connectionSpec.getAddress().getHostAddress(), connectionSpec.getPort()); try{ jredis.ping(); jredis.quit(); }catch(Exception e){ return false; } return true; } public void initialize(){ defaultConnectionSpec = this.getConnectionSpec(); if(jredisService == null){ synchronized (RedisFailToleranceUtil.class) { jredisService = new JRedisService(defaultConnectionSpec,100); } } } public String getS(String key){ this.initialize(); String value = null; try { value = DefaultCodec.toStr(jredisService.get(key)); } catch (Exception e) { defaultConnectionSpec = null; this.initialize(); } return value; } public static void main(String args[]){ RedisFailToleranceUtil redis = new RedisFailToleranceUtil(); redis.getS("name"); try { Thread.sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } redis.getS("name"); try { Thread.sleep(30000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } redis.getS("name"); } }
改成jedis的
public class JedisPoolTest extends Assert { private static HostAndPort hnp = HostAndPortUtil.getRedisServers().get(0); private static HostAndPort hnp2 = HostAndPortUtil.getRedisServers().get(1); private static HashMap<String,JedisPool> serverPools = new HashMap<String,JedisPool>(); static{ JedisPool pool1 = new JedisPool(new JedisPoolConfig(), hnp.host, hnp.port, 2000); JedisPool pool2 = new JedisPool(new JedisPoolConfig(), hnp2.host, hnp2.port, 2000); serverPools.put("1", pool1); serverPools.put("2", pool2); } private static int current = 1; static Jedis jredisService=null; private static JedisPool defaultConnectionSpec = null; public void initialize(){ defaultConnectionSpec = this.getConnectionSpec(); if(jredisService == null){ synchronized (RedisFailToleranceUtil.class) { jredisService = defaultConnectionSpec.getResource(); } } } public String getS(String key){ this.initialize(); String value = null; try { value = jredisService.get(key); } catch (Exception e) { defaultConnectionSpec = null; this.initialize(); } return value; } public static void main(String[] args) { JedisPoolTest redis = new JedisPoolTest(); System.out.println("1 "+redis.getS("foo")); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("2 "+redis.getS("foo")); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("3 "+redis.getS("foo")); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("4 "+redis.getS("foo")); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("5 "+redis.getS("foo")); } private JedisPool getConnectionSpec(){ if(defaultConnectionSpec != null){ return defaultConnectionSpec; } HashMap<String,JedisPool> tryServers = new HashMap<String,JedisPool>(serverPools); System.out.println("tryServers:"+tryServers.size()); if(serverPools.size() == 1){ System.out.println("22222"); //jredisService=connectionSpec.getResource(); return (JedisPool)serverPools.get("2"); } while(!tryServers.isEmpty()){ JedisPool connectionSpec = tryServers.get("1"); if(isConnect(connectionSpec)){ System.out.println("1111"); jredisService=connectionSpec.getResource(); return connectionSpec; }else{ connectionSpec = tryServers.get("2"); jredisService=connectionSpec.getResource(); System.out.println("1111---2222"); serverPools.remove("1"); return connectionSpec; } } return null; } private boolean isConnect(JedisPool pool){ if(pool == null){ return false; } try{ Jedis jedis = pool.getResource(); jedis.ping(); pool.returnResource(jedis); }catch(Exception e){ return false; } return true; } }
----------------
安装
jredis
https://github.com/alphazero/jredis/downloads
http://liuxinglanyue.iteye.com/blog/829428
参数说明
http://aronlulu.iteye.com/blog/1236773
appendonly 默认情况下,redis 会在后台异步的把数据库镜像备份到磁盘,但是该备份是非常耗时 的,而且备份也不能很频繁,如果发生诸如拉闸限电、拔插头等状况,那么将造成比较 大范围的数据丢失。所以 redis提供了另外一种更加高效的数据库备份及灾难恢复方式。 开启 append only 模式之后,redis 会把所接收到的每一次写操作请求都追加到 appendonly.aof 文件中,当redis重新启动时,会从该文件恢复出之前的状态。但是这样 会造成 appendonly.aof 文件过大,所以 redis 还支持了 BGREWRITEAOF 指令,对 appendonly.aof 进行重新整理。所以我认为推荐生产环境下的做法为关闭镜像,开启 appendonly.aof,同时可以选择在访问较少的时间每天对 appendonly.aof 进行重写一次
注意dump.rdb文件
默认在redis-server的同一个目录下
dir指定
官方文档
http://try.redis-db.com/
导出json
https://github.com/delano/redis-dump
--------------
rais的安装
http://archive.cnblogs.com/a/1937602/
http://www.cnblogs.com/watir/archive/2011/01/17/1937602.html
为了装https://github.com/steelThread/redmon
redmon
sqlite3报错
http://blog.toolib.net/cnmahj/2011/09/rails3-1%E4%BD%BF%E7%94%A8sqlite%E6%97%B6%E2%80%9Csqlite3_int64-undeclared%E2%80%9D%E9%94%99%E8%AF%AF%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/
i容量预计和估算
http://blog.nosqlfan.com/html/3430.html
u不过发现脚本执行几次,差值不一样
数据增量存储
http://www.hoterran.info/redis_persistence
源码分析
http://blog.nosqlfan.com/html/2949.html?ref=rediszt
资料总会专题
http://blog.nosqlfan.com/html/3537.html
Redis采用不同内存分配器碎片率对比
http://blog.nosqlfan.com/html/3490.html
目录
http://blog.nosqlfan.com/tags/redis
Redis复制与可扩展集群搭建
http://www.infoq.com/cn/articles/tq-redis-copy-build-scalable-cluster
测试,需要看valgrind
http://blog.nosqlfan.com/html/2383.html
容量
http://timyang.net/data/redis-capacity/
微波两个人
http://weibo.com/bachmozart?key_word=redis
http://weibo.com/tangfl?key_word=redis
lua
http://blog.nosqlfan.com/html/1658.html
ruby的监控
用最新版zlib问题
https://rvm.beginrescueend.com/rvm/install/
http://belmount.blog.51cto.com/1897431/766728
https://blog.johncheng.com/?p=1389
rvm
http://floger.iteye.com/blog/935374
不用openssl
最后那个运行下就行
rvm requirements
rvm install 1.9.3
rvm list
rvm alias create default ruby-1.9.3-p125
gem install bundler
rvm rubygems latest
rvm pkg install openssl
gem install rails
rvm gemset list
看rails的版本,然后
rvm gemset create rails3.2.1
rvm pkg install zlib ;
rvm pkg install readline;
rvm pkg install openssl;
rvm pkg install iconv;
rvm remove 1.9.3;
rvm install 1.9.3 --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr
rvm gemset create rails3.2.1
zlib
https://rvm.beginrescueend.com/packages/zlib/
Ruby 1.9.3-p0 makes psych—the replacement for 1.8.7’s YAML library,
http://www.cnblogs.com/qq78292959/archive/2011/12/15/2288567.html
rvm info
rvm requirements
rvm install 1.8.7
rvm list
rvm alias create default ruby-1.8.7-p358
ruby -v
gem install rails
rvm gemset list
rvm gemset list
rvm gemset create rails3.2.1
gem install jquery-rails
rails new demo1
集群
http://wenku.baidu.com/view/d9ac5ab9960590c69ec37683.html
cassandra
http://baike.baidu.com/view/1350234.htm
2.6 Redis集群功能说明
http://blog.nosqlfan.com/html/3302.html
ppt
http://blog.nosqlfan.com/html/1007.html
hash
http://emreyilmaz.me/implementing-consistent-hashing-into-your-redis
发表评论
-
xl2tp 备份
2019-09-24 16:25 7632019年9月24日更新: 注意,需要开启firewall ... -
sdl笔记
2019-01-31 17:19 752sdl教程教程 https://github.com/Twin ... -
tinyemu
2019-01-24 17:59 1460参考https://bellard.org/jslinux/t ... -
aws搭建xl2tp给iphone使用
2018-12-26 21:37 19202019年12月26日 可以参考原来的配置 https:// ... -
consul的基本使用
2017-06-27 11:13 1425### 安装 [centos7上consul的安装](ht ... -
lvs的helloworld
2017-06-13 20:36 610###################lvs######### ... -
系统调用的helloworld
2017-05-04 16:14 670《2.6内核标准教程》 p293 #include < ... -
bitcoin和cgminer的安装
2017-04-05 22:45 1975参考 http://blog.csdn.net/rion_ch ... -
ceph安装和常用命令
2017-03-21 21:55 971/etc/hosts ssh-keygen ssh-copy- ... -
mobile terminal 笔记
2016-12-02 15:35 667找出旧的iphone4 越狱之后可以变个小操作系统 mobi ... -
socket基础和select(python)
2016-06-14 17:21 1823上接 c语言的socket基础ht ... -
socket基础(c语言)
2016-06-14 16:45 1028不使用select 普通的基础socket连接,对多个客户端的 ... -
ffmpeg+nginx 的直播(2,直播摄像头和麦克风)
2016-05-28 20:21 4409假设我的服务器是centos7 192.168.139.117 ... -
ffmpeg+nginx 的直播(1,直播播放的视频文件)
2016-05-26 17:11 664264位操作系统centos7 ############ 1.一 ... -
socat和netcat(nc)
2016-04-29 22:36 1773转 原文链接: http://www.wenquan.name ... -
neutron基础九(qemu nat网络)
2016-02-06 17:21 1647接上基础八,kvm透传nested忽略 1.在主机ce ... -
neutron基础八(qemu 桥接网络)
2016-02-06 13:13 1560qemu的桥接和nat的qemu启动命令是一样的,但是后续的脚 ... -
neutron基础七(qemu tap)
2016-02-02 17:02 1047使用qemu 建立个虚拟机 然后用tap设备, 根据基础六,t ... -
neutron基础六(bridge fdb)
2016-01-28 18:30 2297转发表 在三台机器上建立三个namespace 192.16 ... -
南北流量
2016-01-23 23:26 1851一、三层网络架构: 接入层:负责服务器的接入和隔离 汇聚层:汇 ...
相关推荐
Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装...
在Windows上安装Redis的过程涉及到多个步骤,包括启用必要的Windows功能、安装WSL2(Windows Subsystem for Linux 2)、设置默认WSL版本以及在Linux环境中安装Redis。以下是对这些步骤的详细说明: 1. **启用...
Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接工具的安装Redis链接...
离线安装Redis对于那些没有互联网连接或者网络环境受限的服务器来说尤为重要。以下是一个详细的步骤指南,帮助你在Linux系统上离线安装和配置Redis 4.0.10版本。 首先,你需要准备Redis的源码包。在这个案例中,...
linux系统下redis数据库编译安装安装包+详细安装流程 可适用欧拉系统centos7等操作系统 详细讲解了操作过程和遇到的一些列问题
在 Windows 上安装 Redis,你需要遵循以下步骤: 首先,从 Redis 的官方网站(https://redis.io/download)下载适合你操作系统的版本。在提供的信息中,我们看到的是 Redis-x64-5.0.14.1.msi,这是一个适用于64位...
在本套资源中,我们有Redis 3.2.0的安装文件和对应的安装文档,这将帮助你在Linux环境下快速搭建Redis服务器。下面将详细介绍Redis 3.2.0的安装步骤以及一些关键知识点。 首先,确保你的系统满足安装Redis的基本...
**Redis在CentOS7上的安装指南** Redis是一个高性能的键值数据库,广泛应用于缓存、消息中间件等领域。在CentOS7系统上安装Redis需要遵循一系列步骤,下面将详细介绍整个过程。 ### 一、更新系统 在安装任何新...
实现了自动安装配置redis 已经测试过了,如果有问题,请留言 启动脚本需要 3个参数 serverIP masterIP redisType 例如, 作为master ./redis_create.sh 192.168.10.10 192.168.10.10 master 作为slave ./redis_...
本资源可结合我的文章《详解CentOS7下编译安装Redis5.x设置开机启动及修改端口(含redis需编译安装包和redis免编译安装包)》配合使用,同时也可单独去使用。包含redis3.0.7免编译版安装包,redis5.0.7离线安装包,...
redis6.0离线安装使用-centos7
本文将详细介绍Redis的配置和安装过程,帮助你快速上手这个强大的内存数据存储系统。 ### 安装Redis #### 1. 下载Redis源码 首先,访问Redis官方网站(https://redis.io/download)下载最新版本的源代码。你可以...
### Linux下Redis 3.2.2安装与启动配置 #### 环境准备 - **操作系统**: CentOS 6.5 (2.6.32-431.el6.x86_64) - **软件**: Redis 3.2.2 #### 下载与解压 1. 使用`wget`命令下载Redis安装包: ```bash wget ...
在本文中,我们将探讨如何在Ubuntu操作系统上搭建Redis虚拟机环境,并安装Redis服务器,同时也会涉及SSH工具连接虚拟机的相关问题。 首先,为了在Ubuntu虚拟机上安装Redis,我们需要确保虚拟机已经配置妥当并运行。...
本文将详细介绍Redis 5.0.8的安装与基本配置过程,确保您能够顺利地在服务器上部署并运行Redis服务。 首先,从Redis官方网站(https://redis.io/)下载最新稳定版的Redis安装包,例如Redis-5.0.8.tar.gz。将其放置在...
在Linux环境中离线安装Redis是常见的需求,尤其是在内网服务器上,由于无法直接访问公网,我们需要提前下载Redis的源码包并手动安装。下面将详细解释如何进行这一过程。 首先,你需要从Redis官方网站获取Redis的...
在没有网络连接或者网络环境不稳定的情况下,离线安装Redis在Linux上通常是通过RPM包来完成的。以下是一份详细的Redis在Linux环境下使用RPM包进行离线安装的步骤: 1. **下载Redis RPM包**: 首先,你需要在有网络...
在某些环境下,如服务器无网络连接或者网络环境受限时,我们需要进行离线安装Redis。在这个过程中,`gcc`扮演了至关重要的角色,因为它是一种通用的编译器,用于将源代码转换为可执行程序。在本文中,我们将深入探讨...
在Linux系统中部署Redis需要遵循一系列步骤,这通常涉及到安装依赖程序、下载源码、编译安装、配置服务以及设置安全性。以下是根据提供的文件信息详细阐述的Redis安装和配置过程。 1. **检查系统环境**:在开始安装...
完成安装后,你需要配置Redis服务器,可以通过修改`redis.conf`配置文件来实现。配置项包括端口号、数据持久化、内存限制、安全性等。默认情况下,Redis会在6379端口监听。 启动Redis服务器,Linux用户通常使用`...