当前位置: 首页 > news >正文

温州专业手机网站制作哪家便宜怎么做刷业网站

温州专业手机网站制作哪家便宜,怎么做刷业网站,顶尖的赣州网站建设,wordpress 分类目录 标签本文整理汇总了Python中redis.sentinel方法的典型用法代码示例。如果您正苦于以下问题#xff1a;Python redis.sentinel方法的具体用法#xff1f;Python redis.sentinel怎么用#xff1f;Python redis.sentinel使用的例子#xff1f;那么恭喜您, 这里精选的方法代码示例或…本文整理汇总了Python中redis.sentinel方法的典型用法代码示例。如果您正苦于以下问题Python redis.sentinel方法的具体用法Python redis.sentinel怎么用Python redis.sentinel使用的例子那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块redis的用法示例。在下文中一共展示了redis.sentinel方法的14个代码示例这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞您的评价将有助于我们的系统推荐出更棒的Python代码示例。示例1: _get_service_names​点赞 6​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def _get_service_names(self): # type: () - List[six.text_type]Get a list of service names from Sentinel. Tries Sentinel hosts until one succeeds; if none succeed,raises a ConnectionError.:return: the list of service names from Sentinel.master_info Noneconnection_errors []for sentinel in self._sentinel.sentinels:# Unfortunately, redis.sentinel.Sentinel does not support sentinel_masters, so we have to step# through all of its connections manuallytry:master_info sentinel.sentinel_masters()breakexcept (redis.ConnectionError, redis.TimeoutError) as e:connection_errors.append(Failed to connect to {} due to error: {}..format(sentinel, e))continueif master_info is None:raise redis.ConnectionError(Could not get master info from Sentinel\n{}:.format(\n.join(connection_errors)))return list(master_info.keys())开发者ID:eventbrite项目名称:pysoa代码行数:25示例2: _get_connection​点赞 6​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def _get_connection(self, index): # type: (int) - redis.StrictRedisif not 0 index self._ring_size:raise ValueError(There are only {count} hosts, but you asked for connection {index}..format(countself._ring_size,indexindex,))for i in range(self._sentinel_failover_retries 1):try:return self._get_master_client_for(self._services[index])except redis.sentinel.MasterNotFoundError:self.reset_clients() # make sure we reach out to get master info again on next call_logger.warning(Redis master not found, so resetting clients (failover?))if i ! self._sentinel_failover_retries:self._get_counter(backend.sentinel.master_not_found_retry).increment()time.sleep((2 ** i random.random()) / 4.0)raise CannotGetConnectionError(Master not found; gave up reloading master info after failover.)开发者ID:eventbrite项目名称:pysoa代码行数:22示例3: setUp​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def setUp(self): Clear all spans before a test run self.recorder tracer.recorderself.recorder.clear_spans()# self.sentinel Sentinel([(testenv[redis_host], 26379)], socket_timeout0.1)# self.sentinel_master self.sentinel.discover_master(mymaster)# self.client redis.Redis(hostself.sentinel_master[0])self.client redis.Redis(hosttestenv[redis_host])开发者ID:instana项目名称:python-sensor代码行数:12示例4: setUp​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def setUp(self):pymemcache.client.Client((localhost, 22122)).flush_all()redis.from_url(unix:///tmp/limits.redis.sock).flushall()redis.from_url(redis://localhost:7379).flushall()redis.from_url(redis://:sekretlocalhost:7389).flushall()redis.sentinel.Sentinel([(localhost, 26379)]).master_for(localhost-redis-sentinel).flushall()rediscluster.RedisCluster(localhost, 7000).flushall()if RUN_GAE:from google.appengine.ext import testbedtb testbed.Testbed()tb.activate()tb.init_memcache_stub()开发者ID:alisaifee项目名称:limits代码行数:16示例5: test_storage_check​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def test_storage_check(self):self.assertTrue(storage_from_string(memory://).check())self.assertTrue(storage_from_string(redis://localhost:7379).check())self.assertTrue(storage_from_string(redis://:sekretlocalhost:7389).check())self.assertTrue(storage_from_string(redisunix:///tmp/limits.redis.sock).check())self.assertTrue(storage_from_string(memcached://localhost:22122).check())self.assertTrue(storage_from_string(memcached://localhost:22122,localhost:22123).check())self.assertTrue(storage_from_string(memcached:///tmp/limits.memcached.sock).check())self.assertTrue(storage_from_string(redissentinel://localhost:26379,service_namelocalhost-redis-sentinel).check())self.assertTrue(storage_from_string(rediscluster://localhost:7000).check())if RUN_GAE:self.assertTrue(storage_from_string(gaememcached://).check())开发者ID:alisaifee项目名称:limits代码行数:41示例6: setUp​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def setUp(self):self.storage_url redissentinel://localhost:26379self.service_name localhost-redis-sentinelself.storage RedisSentinelStorage(self.storage_url,service_nameself.service_name)redis.sentinel.Sentinel([(localhost, 26379)]).master_for(self.service_name).flushall()开发者ID:alisaifee项目名称:limits代码行数:12示例7: setUp​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def setUp(self):pymemcache.client.Client((localhost, 22122)).flush_all()redis.from_url(redis://localhost:7379).flushall()redis.from_url(redis://:sekretlocalhost:7389).flushall()redis.sentinel.Sentinel([(localhost, 26379)]).master_for(localhost-redis-sentinel).flushall()rediscluster.RedisCluster(localhost, 7000).flushall()开发者ID:alisaifee项目名称:limits代码行数:10示例8: test_fixed_window_with_elastic_expiry_redis_sentinel​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def test_fixed_window_with_elastic_expiry_redis_sentinel(self):storage RedisSentinelStorage(redissentinel://localhost:26379,service_namelocalhost-redis-sentinel)limiter FixedWindowElasticExpiryRateLimiter(storage)limit RateLimitItemPerSecond(10, 2)self.assertTrue(all([limiter.hit(limit) for _ in range(0, 10)]))time.sleep(1)self.assertFalse(limiter.hit(limit))time.sleep(1)self.assertFalse(limiter.hit(limit))self.assertEqual(limiter.get_window_stats(limit)[1], 0)开发者ID:alisaifee项目名称:limits代码行数:15示例9: get_connection​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def get_connection(self, is_read_onlyFalse) - redis.StrictRedis:Gets a StrictRedis connection for normal redis or for redis sentinelbased upon redis mode in configuration.:type is_read_only: bool:param is_read_only: In case of redis sentinel, it returns connectionto slave:return: Returns a StrictRedis connectionif self.connection is not None:return self.connectionif self.is_sentinel:kwargs dict()if self.password:kwargs[password] self.passwordsentinel Sentinel([(self.host, self.port)], **kwargs)if is_read_only:connection sentinel.slave_for(self.sentinel_service,decode_responsesTrue)else:connection sentinel.master_for(self.sentinel_service,decode_responsesTrue)else:connection redis.StrictRedis(hostself.host, portself.port,decode_responsesTrue,passwordself.password)self.connection connectionreturn connection开发者ID:biplap-sarkar项目名称:pylimit代码行数:33示例10: get_atomic_connection​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def get_atomic_connection(self) - Pipeline:Gets a Pipeline for normal redis or for redis sentinel based uponredis mode in configuration:return: Returns a Pipeline objectreturn self.get_connection().pipeline(True)开发者ID:biplap-sarkar项目名称:pylimit代码行数:10示例11: __init__​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def __init__(self):if self.REDIS_SENTINEL:sentinels [tuple(s.split(:)) for s in self.REDIS_SENTINEL.split(;)]self._sentinel redis.sentinel.Sentinel(sentinels,dbself.REDIS_SENTINEL_DB,socket_timeout0.1)else:self._redis redis.Redis.from_url(self.rewrite_redis_url())开发者ID:ybrs项目名称:single-beat代码行数:10示例12: _get_master_client_for​点赞 5​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def _get_master_client_for(self, service_name): # type: (six.text_type) - redis.StrictRedisif service_name not in self._master_clients:self._get_counter(backend.sentinel.populate_master_client).increment()self._master_clients[service_name] self._sentinel.master_for(service_name)master_address self._master_clients[service_name].connection_pool.get_master_address()_logger.info(Sentinel master address: {}.format(master_address))return self._master_clients[service_name]开发者ID:eventbrite项目名称:pysoa代码行数:10示例13: _get_redis_connection​点赞 4​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def _get_redis_connection(self, group, shard):Create and return a Redis Connection for the given groupReturns:redis.StrictRedis: The Redis ConnectionRaises:Exception: Passes through any exceptions that happen in trying to get the connection poolredis_group self.__config.redis_urls_by_group[group][shard]self.__logger.info(uAttempting to connect to Redis for group {}, shard {}, url {}.format(group, shard,redis_group))if isinstance(redis_group, PanoptesRedisConnectionConfiguration):redis_pool redis.BlockingConnectionPool(hostredis_group.host,portredis_group.port,dbredis_group.db,passwordredis_group.password)redis_connection redis.StrictRedis(connection_poolredis_pool)elif isinstance(redis_group, PanoptesRedisSentinelConnectionConfiguration):sentinels [(sentinel.host, sentinel.port) for sentinel in redis_group.sentinels]self.__logger.info(uQuerying Redis Sentinels {} for group {}, shard {}.format(repr(redis_group),group, shard))sentinel redis.sentinel.Sentinel(sentinels)master sentinel.discover_master(redis_group.master_name)password_present uyes if redis_group.master_password else unoself.__logger.info(uGoing to connect to master {} ({}:{}, password: {}) for group {}, shard {}.format(redis_group.master_name, master[0], master[1], password_present, group, shard))redis_connection sentinel.master_for(redis_group.master_name, passwordredis_group.master_password)else:self.__logger.info(uUnknown Redis configuration object type: {}.format(type(redis_group)))returnself.__logger.info(uSuccessfully connected to Redis for group {}, shard {}, url {}.format(group,shard,redis_group))return redis_connection开发者ID:yahoo项目名称:panoptes代码行数:46示例14: __init__​点赞 4​# 需要导入模块: import redis [as 别名]# 或者: from redis import sentinel [as 别名]def __init__(self,hostsNone, # type: Optional[Iterable[Union[six.text_type, Tuple[six.text_type, int]]]]connection_kwargsNone, # type: Dict[six.text_type, Any]sentinel_servicesNone, # type: Iterable[six.text_type]sentinel_failover_retries0, # type: intsentinel_kwargsNone, # type: Dict[six.text_type, Any]):# type: (...) - None# Master client cachingself._master_clients {} # type: Dict[six.text_type, redis.StrictRedis]# Master failover behaviorif sentinel_failover_retries 0:raise ValueError(sentinel_failover_retries must be 0)self._sentinel_failover_retries sentinel_failover_retriesconnection_kwargs dict(connection_kwargs) if connection_kwargs else {}if socket_connect_timeout not in connection_kwargs:connection_kwargs[socket_connect_timeout] 5.0 # so that we dont wait indefinitely during failoverif socket_keepalive not in connection_kwargs:connection_kwargs[socket_keepalive] Trueif (connection_kwargs.pop(ssl, False) or ssl_certfile in connection_kwargs) and connection_class not in connection_kwargs:# TODO: Remove this when https://github.com/andymccurdy/redis-py/issues/1306 is releasedconnection_kwargs[connection_class] _SSLSentinelManagedConnectionsentinel_kwargs dict(sentinel_kwargs) if sentinel_kwargs else {}if socket_connect_timeout not in sentinel_kwargs:sentinel_kwargs[socket_connect_timeout] 5.0 # so that we dont wait indefinitely connecting to Sentinelif socket_timeout not in sentinel_kwargs:sentinel_kwargs[socket_timeout] 5.0 # so that we dont wait indefinitely if a Sentinel goes downif socket_keepalive not in sentinel_kwargs:sentinel_kwargs[socket_keepalive] Trueself._sentinel redis.sentinel.Sentinel(self._convert_hosts(hosts),sentinel_kwargssentinel_kwargs,**connection_kwargs)if sentinel_services:self._validate_service_names(sentinel_services)self._services list(sentinel_services) # type: List[six.text_type]else:self._services self._get_service_names()super(SentinelRedisClient, self).__init__(ring_sizelen(self._services))开发者ID:eventbrite项目名称:pysoa代码行数:50注本文中的redis.sentinel方法示例整理自Github/MSDocs等源码及文档管理平台相关代码片段筛选自各路编程大神贡献的开源项目源码版权归原作者所有传播和使用请参考对应项目的License未经允许请勿转载。
http://www.zqtcl.cn/news/346019/

相关文章:

  • 北京社保网站减员怎么做phpcms v9 实现网站搜索
  • 视频运营管理网站济南网站建设 济南货梯
  • html电影网站模板下载工具阿里云网站建设 部署与发布笔记
  • 建设跨境网站微信seo是什么意思
  • 我做彩票网站开发彩票网站搭建织梦如何仿手机网站源码下载
  • 东仓建设网站手机便宜的网站建设
  • 吕梁市住房与城乡建设厅网站wordpress 乐趣公园
  • 沈阳正规制作网站公司吗德成建设集团有限公司网站
  • 做网站标准步骤大学两学一做专题网站
  • 如何在手机上做网站Windows怎么建设网站
  • 专门做稀有产品的网站海口网站制作设计
  • 怎么查看自己的网站是否被百度收录网站的设计制作流程
  • 视觉设计网站芜湖做网站找哪家好
  • flash网站源码带asp后台电子商务有限公司网站
  • 一个网站有多少网页简单的logo设计
  • 重庆专业网站营销长春建站免费模板
  • 企业建设网站多少钱爱的网站歌曲
  • 宁波网站优化如何欣宝儿在什么网站做直播
  • 东营网签查询系统官方网站超炫的网站模板
  • 请人做网站谁来维护南宁营销型网站设计
  • 汕头做网站的公司西安建筑科技大学华清学院教务网
  • 免费行情网站在线石家庄正规制作网站公司
  • 站长工具网凡科网商城
  • 网站开发工程师需要会写什么区别沈阳网站建设建设公司哪家好
  • 营销型网站建设的优缺点利用海康威视做直播网站
  • 阿里手机网站开发框架怎么看网站被降权
  • 电视台做网站还是APP网络推广是什么意思
  • 浙江鼎兴建设有限公司网站wordpress看不到安装的主题
  • 琪觅公司网站开发c语言开发环境
  • 在哪个网站上做实验仪器比较好信息服务平台有哪些