本文整理汇总了Python中cluster.Cluster.name方法的典型用法代码示例。如果您正苦于以下问题:Python Cluster.name方法的具体用法?Python Cluster.name怎么用?Python Cluster.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cluster.Cluster
的用法示例。
在下文中一共展示了Cluster.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: name
# 需要导入模块: from cluster import Cluster [as 别名]
# 或者: from cluster.Cluster import name [as 别名]
access = os.environ['EC2_SECRET_KEY']
# what is the domain to work with
name = os.environ['REDIS_NAME'].strip()
zone_name = os.environ['HOSTED_ZONE_NAME'].rstrip('.')
zone_id = os.environ['HOSTED_ZONE_ID']
# the name (and identity) of the cluster (the master)
cluster = "{0}.{1}".format(name, zone_name)
# get/create the cluster environment
cluster = Cluster(key, access, cluster)
r53_zone = Route53Zone(key, access, zone_id)
ec2 = EC2(key, access)
events = Events(key, access, cluster.name())
host = Host(cluster.name(), events)
node = host.get_node()
endpoint = host.get_endpoint()
component = os.path.basename(sys.argv[0])
def log(message, logging='info'):
events.log(node, component, message, logging)
if __name__ == '__main__':
log('leaving the cluster', 'info')
#try:
# do not remove the tag, we might want to work on this later
# delete all there is to us
#log('unset the tag', 'info')
#ec2.unset_tag()
示例2: name
# 需要导入模块: from cluster import Cluster [as 别名]
# 或者: from cluster.Cluster import name [as 别名]
access = os.environ['EC2_SECRET_KEY']
# what is the domain to work with
name = os.environ['REDIS_NAME'].strip()
zone_name = os.environ['HOSTED_ZONE_NAME'].rstrip('.')
zone_id = os.environ['HOSTED_ZONE_ID']
# the name (and identity) of the cluster (the master)
cluster = "{0}.{1}".format(name, zone_name)
# get/create the cluster environment
cluster = Cluster(key, access, cluster)
r53_zone = Route53Zone(key, access, zone_id)
ec2 = EC2(key, access)
events = Events(key, access, cluster.name())
host = Host(cluster.name(), events)
node = host.get_node()
endpoint = host.get_endpoint()
component = os.path.basename(sys.argv[0])
def log(message, logging='info'):
events.log(node, component, message, logging)
r = redis.StrictRedis(host='localhost', port=6379)
if __name__ == '__main__':
# make sure we get the redis master, perhaps our master is already gone
# from the cluster
try:
log('get Redis INFO', 'info')
info = r.info()
示例3: name
# 需要导入模块: from cluster import Cluster [as 别名]
# 或者: from cluster.Cluster import name [as 别名]
# your amazon keys
key = os.environ['EC2_KEY_ID']
access = os.environ['EC2_SECRET_KEY']
# what is the domain to work with
name = os.environ['REDIS_NAME'].strip()
zone_name = os.environ['HOSTED_ZONE_NAME'].rstrip('.')
zone_id = os.environ['HOSTED_ZONE_ID']
# the name (and identity) of the cluster (the master)
cluster = "{0}.{1}".format(name, zone_name)
# get/create the cluster environment
cluster = Cluster(key, access, cluster)
events = Events(key, access, cluster.name())
host = Host(cluster.name(), events)
node = host.get_node()
endpoint = host.get_endpoint()
component = os.path.basename(sys.argv[0])
def log(message, logging='info'):
events.log(node, component, message, logging)
r = redis.StrictRedis(host='localhost', port=6379)
if __name__ == '__main__':
try:
log('get Redis INFO', 'info')
info = r.info()
log('get the link_status', 'info')
示例4: name
# 需要导入模块: from cluster import Cluster [as 别名]
# 或者: from cluster.Cluster import name [as 别名]
access = os.environ['EC2_SECRET_KEY']
# what is the domain to work with
name = os.environ['REDIS_NAME'].strip()
zone_name = os.environ['HOSTED_ZONE_NAME']
zone_id = os.environ['HOSTED_ZONE_ID']
# the name (and identity) of the cluster (the master)
cluster = "{0}.{1}".format(name, zone_name.rstrip('.'))
# get/create the cluster environment
cluster = Cluster(key, access, cluster)
r53_zone = Route53Zone(key, access, zone_id)
ec2 = EC2(key, access)
events = Events(key, access, cluster.name())
host = Host(cluster.name(), events)
node = host.get_node()
endpoint = host.get_endpoint()
component = os.path.basename(sys.argv[0])
def log(message, logging='info'):
events.log(node, component, message, logging)
if __name__ == '__main__':
log('joining the cluster', 'info')
log('adding the node to the cluster', 'info')
# now we are ready to be (added to) the cluster
cluster.add_node(node, endpoint)
log('creating a Route53 records', 'info')
r53_zone.create_record(node, endpoint)