本文整理汇总了Python中membase.api.rest_client.RestConnection.set_data_path方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.set_data_path方法的具体用法?Python RestConnection.set_data_path怎么用?Python RestConnection.set_data_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.set_data_path方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reset
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def reset(self):
self.log.info(
"============== SwapRebalanceBase cleanup was started for test #{0} {1} ==============".format(
self.case_number, self._testMethodName
)
)
self.log.info("Stopping load in Teardown")
SwapRebalanceBase.stop_load(self.loaders)
for server in self.servers:
rest = RestConnection(server)
if rest._rebalance_progress_status() == "running":
self.log.warning("rebalancing is still running, test should be verified")
stopped = rest.stop_rebalance()
self.assertTrue(stopped, msg="unable to stop rebalance")
BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
for server in self.servers:
ClusterOperationHelper.cleanup_cluster([server])
if server.data_path:
rest = RestConnection(server)
rest.set_data_path(data_path=server.data_path)
ClusterOperationHelper.wait_for_ns_servers_or_assert(self.servers, self)
self.log.info(
"============== SwapRebalanceBase cleanup was finished for test #{0} {1} ==============".format(
self.case_number, self._testMethodName
)
)
示例2: initialize
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def initialize(self, params):
# log = logger.new_logger("Installer")
start_time = time.time()
cluster_initialized = False
server = params["server"]
remote_client = RemoteMachineShellConnection(params["server"])
while time.time() < (start_time + (10 * 60)):
rest = RestConnection(server)
try:
rest.init_cluster(username=server.rest_username, password=server.rest_password)
rest.init_cluster_memoryQuota(memoryQuota=rest.get_nodes_self().mcdMemoryReserved)
if server.data_path:
time.sleep(3)
# Make sure that data_path is writable by couchbase user
#remote_client.stop_couchbase()
remote_client.execute_command('rm -rf {0}/*'.format(server.data_path))
remote_client.execute_command("chown -R couchbase:couchbase {0}".format(server.data_path))
rest.set_data_path(data_path=server.data_path)
# Symlink data-dir to custom path
#remote_client.execute_command('mv /opt/couchbase/var {0}'.format(server.data_path))
#remote_client.execute_command('ln -s {0}/var /opt/couchbase/var'.format(server.data_path))
#remote_client.execute_command("chown -h couchbase:couchbase /opt/couchbase/var")
#remote_client.start_couchbase()
time.sleep(3)
cluster_initialized = True
break
except ServerUnavailableException:
log.error("error happened while initializing the cluster @ {0}".format(server.ip))
log.info('sleep for 5 seconds before trying again ...')
time.sleep(5)
if not cluster_initialized:
raise Exception("unable to initialize membase node")
示例3: test_cbDiskConf
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def test_cbDiskConf(self):
ops = self.input.param('ops', None)
source = 'ns_server'
user = self.master.rest_username
rest = RestConnection(self.master)
shell = RemoteMachineShellConnection(self.master)
os_type = shell.extract_remote_info().distribution_type
if (os_type == 'Windows'):
currentPath = "c:/Program Files/Couchbase/Server/var/lib/couchbase/data"
newPath = "C:/tmp"
else:
currentPath = '/opt/couchbase/var/lib/couchbase/data'
newPath = "/tmp"
if (ops == 'indexPath'):
try:
expectedResults = {'node': '[email protected]' + self.master.ip, 'source':source,
'user':user, 'ip':self.ipAddress, 'port':1234,
'index_path':newPath, 'db_path':currentPath,
'cbas_dirs':currentPath}
rest.set_data_path(index_path=newPath)
self.checkConfig(self.eventID, self.master, expectedResults)
finally:
rest.set_data_path(index_path=currentPath)
示例4: _test_install
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def _test_install(self,serverInfo,version,builds):
query = BuildQuery()
info = self.machine_infos[serverInfo.ip]
names = ['membase-server-enterprise',
'membase-server-community',
'couchbase-server-enterprise',
'couchbase-server-community']
build = None
for name in names:
build = query.find_membase_build(builds,
name,
info.deliverable_type,
info.architecture_type,
version.strip())
if build:
break
if not build:
self.fail('unable to find any {0} build for {1} for arch : {2} '.format(info.distribution_type,
info.architecture_type,
version.strip()))
print 'for machine : ', info.architecture_type, info.distribution_type, 'relevant build : ', build
remote_client = RemoteMachineShellConnection(serverInfo)
remote_client.membase_uninstall()
remote_client.couchbase_uninstall()
if 'amazon' in self.input.test_params:
build.url = build.url.replace("http://builds.hq.northscale.net/latestbuilds/",
"http://packages.northscale.com/latestbuilds/")
build.url = build.url.replace("enterprise", "community")
build.name = build.name.replace("enterprise", "community")
downloaded = remote_client.download_build(build)
self.assertTrue(downloaded, 'unable to download binaries :'.format(build.url))
remote_client.membase_install(build)
#TODO: we should poll the 8091 port until it is up and running
self.log.info('wait 5 seconds for membase server to start')
time.sleep(5)
start_time = time.time()
cluster_initialized = False
while time.time() < (start_time + (10 * 60)):
rest = RestConnection(serverInfo)
try:
if serverInfo.data_path:
self.log.info("setting data path to " + serverInfo.data_path)
rest.set_data_path(serverInfo.data_path)
rest.init_cluster(username=serverInfo.rest_username, password=serverInfo.rest_password)
cluster_initialized = True
break
except ServerUnavailableException:
self.log.error("error happened while initializing the cluster @ {0}".format(serverInfo.ip))
self.log.info('sleep for 5 seconds before trying again ...')
time.sleep(5)
self.assertTrue(cluster_initialized,
"error happened while initializing the cluster @ {0}".format(serverInfo.ip))
if not cluster_initialized:
self.log.error("error happened while initializing the cluster @ {0}".format(serverInfo.ip))
raise Exception("error happened while initializing the cluster @ {0}".format(serverInfo.ip))
nodeinfo = rest.get_nodes_self()
rest.init_cluster_memoryQuota(memoryQuota=nodeinfo.mcdMemoryReserved)
rest.init_cluster_memoryQuota(256)
示例5: reset
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def reset(self):
BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
for server in self.servers:
ClusterOperationHelper.cleanup_cluster([server])
rest = RestConnection(server)
if server.data_path:
rest.set_data_path(data_path=server.data_path)
self.log.info("Stopping load in Teardown")
SwapRebalanceBase.stop_load(self.loaders)
ClusterHelper.wait_for_ns_servers_or_assert(self.servers, self)
示例6: initialize
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def initialize(self, params):
start_time = time.time()
cluster_initialized = False
server = params["server"]
remote_client = RemoteMachineShellConnection(params["server"])
while time.time() < start_time + 10 * 60:
try:
# Optionally change node name and restart server
if params.get('use_domain_names', 0):
remote_client.set_node_name(server.ip)
rest = RestConnection(server)
# Initialize cluster
rest.init_cluster(username=server.rest_username,
password=server.rest_password)
memory_quota = rest.get_nodes_self().mcdMemoryReserved
rest.init_cluster_memoryQuota(memoryQuota=memory_quota)
# Make sure that data_path is writable by couchbase user
if server.data_path:
time.sleep(3)
for cmd in ("rm -rf {0}/*".format(server.data_path),
"chown -R couchbase:couchbase {0}".format(server.data_path)):
remote_client.execute_command(cmd)
rest.set_data_path(data_path=server.data_path)
time.sleep(3)
# TODO: Symlink data-dir to custom path
#remote_client.stop_couchbase()
#remote_client.execute_command('mv /opt/couchbase/var {0}'.format(server.data_path))
#remote_client.execute_command('ln -s {0}/var /opt/couchbase/var'.format(server.data_path))
#remote_client.execute_command("chown -h couchbase:couchbase /opt/couchbase/var")
#remote_client.start_couchbase()
# Optionally disable consistency check
if params.get('disable_consistency', 0):
rest.set_couchdb_option(section='couchdb',
option='consistency_check_ratio',
value='0.0')
cluster_initialized = True
break
except ServerUnavailableException:
log.error("error happened while initializing the cluster @ {0}".format(server.ip))
log.info('sleep for 5 seconds before trying again ...')
time.sleep(5)
if not cluster_initialized:
raise Exception("unable to initialize couchbase node")
示例7: reset
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def reset(self):
self.log.info("============== SwapRebalanceBase cleanup was started for test #{0} {1} =============="\
.format(self.case_number, self._testMethodName))
BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
for server in self.servers:
try:
ClusterOperationHelper.cleanup_cluster([server])
except Exception, e:
#it is not guaranteed that the ejected nodes will immediately single nodes
if e.message.find('controller/rebalance failed when invoked with parameters') > -1:
self.log.info(e.message)
self.log.info("Try again in 60 seconds")
time.sleep(60)
ClusterOperationHelper.cleanup_cluster([server])
else:
raise e
time.sleep(10)
if server.data_path:
rest = RestConnection(server)
rest.set_data_path(data_path=server.data_path)
示例8: initialize
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def initialize(self, params):
start_time = time.time()
cluster_initialized = False
server = params["server"]
remote_client = RemoteMachineShellConnection(params["server"])
while time.time() < start_time + 5 * 60:
try:
rest = RestConnection(server)
# Optionally change node name and restart server
if params.get('use_domain_names', 0):
remote_client.set_node_name(server.ip)
rest.rename_node(server.ip)
# Make sure that data_path and index_path are writable by couchbase user
for path in set(filter(None, [server.data_path, server.index_path])):
time.sleep(3)
for cmd in ("rm -rf {0}/*".format(path),
"chown -R couchbase:couchbase {0}".format(path)):
remote_client.execute_command(cmd)
rest.set_data_path(data_path=server.data_path,
index_path=server.index_path)
time.sleep(3)
# Initialize cluster
rest.init_cluster(username=server.rest_username,
password=server.rest_password)
memory_quota = rest.get_nodes_self().mcdMemoryReserved
rest.init_cluster_memoryQuota(memoryQuota=memory_quota)
# TODO: Symlink data-dir to custom path
# remote_client.stop_couchbase()
# remote_client.execute_command('mv /opt/couchbase/var {0}'.format(server.data_path))
# remote_client.execute_command('ln -s {0}/var /opt/couchbase/var'.format(server.data_path))
# remote_client.execute_command("chown -h couchbase:couchbase /opt/couchbase/var")
# remote_client.start_couchbase()
# Optionally disable consistency check
if params.get('disable_consistency', 0):
rest.set_couchdb_option(section='couchdb',
option='consistency_check_ratio',
value='0.0')
# memcached env variable
mem_req_tap_env = params.get('MEMCACHED_REQS_TAP_EVENT', 0)
if mem_req_tap_env:
remote_client.set_environment_variable('MEMCACHED_REQS_TAP_EVENT',
mem_req_tap_env)
remote_client.disconnect()
# TODO: Make it work with windows
if "erlang_threads" in params:
num_threads = params.get('erlang_threads', testconstants.NUM_ERLANG_THREADS)
# Stop couchbase-server
ClusterOperationHelper.stop_cluster([server])
if "sync_threads" in params or ':' in num_threads:
sync_threads = params.get('sync_threads', True)
else:
sync_threads = False
# Change type of threads(sync/async) and num erlang threads
ClusterOperationHelper.change_erlang_threads_values([server], sync_threads, num_threads)
# Start couchbase-server
ClusterOperationHelper.start_cluster([server])
if "erlang_gc_level" in params:
erlang_gc_level = params.get('erlang_gc_level', None)
if erlang_gc_level is None:
# Don't change the value
break
# Stop couchbase-server
ClusterOperationHelper.stop_cluster([server])
# Change num erlang threads
ClusterOperationHelper.change_erlang_gc([server], erlang_gc_level)
# Start couchbase-server
ClusterOperationHelper.start_cluster([server])
cluster_initialized = True
break
except ServerUnavailableException:
log.error("error happened while initializing the cluster @ {0}".format(server.ip))
log.info('sleep for 5 seconds before trying again ...')
time.sleep(5)
if not cluster_initialized:
raise Exception("unable to initialize couchbase node")
示例9: initialize
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import set_data_path [as 别名]
def initialize(self, params):
log.info('*****CouchbaseServerInstaller initialize the application ****')
start_time = time.time()
cluster_initialized = False
server = params["server"]
remote_client = RemoteMachineShellConnection(params["server"])
while time.time() < start_time + 5 * 60:
try:
rest = RestConnection(server)
# Optionally change node name and restart server
if params.get('use_domain_names', 0):
RemoteUtilHelper.use_hostname_for_server_settings(server)
# Make sure that data_path and index_path are writable by couchbase user
for path in set(filter(None, [server.data_path, server.index_path])):
time.sleep(3)
for cmd in ("rm -rf {0}/*".format(path),
"chown -R couchbase:couchbase {0}".format(path)):
remote_client.execute_command(cmd)
rest.set_data_path(data_path=server.data_path,
index_path=server.index_path)
time.sleep(3)
# Initialize cluster
if "init_nodes" in params:
init_nodes = params["init_nodes"]
else:
init_nodes = "True"
if (isinstance(init_nodes, bool) and init_nodes) or \
(isinstance(init_nodes, str) and init_nodes.lower() == "true"):
if not server.services:
set_services = ["kv"]
elif server.services:
set_services = server.services.split(',')
kv_quota = 0
while kv_quota == 0:
time.sleep(1)
kv_quota = int(rest.get_nodes_self().mcdMemoryReserved)
info = rest.get_nodes_self()
cb_version = info.version[:5]
if cb_version in COUCHBASE_FROM_VERSION_4:
if "index" in set_services and "fts" not in set_services:
log.info("quota for index service will be %s MB" \
% (INDEX_QUOTA))
kv_quota = int(info.mcdMemoryReserved * 2/3) - INDEX_QUOTA
log.info("set index quota to node %s " % server.ip)
rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
if kv_quota < MIN_KV_QUOTA:
raise Exception("KV RAM needs to be more than %s MB"
" at node %s" % (MIN_KV_QUOTA, server.ip))
elif "index" in set_services and "fts" in set_services:
log.info("quota for index service will be %s MB" \
% (INDEX_QUOTA))
log.info("quota for fts service will be %s MB" \
% (FTS_QUOTA))
kv_quota = int(info.mcdMemoryReserved * 2/3)\
- INDEX_QUOTA \
- FTS_QUOTA
log.info("set both index and fts quota at node %s "\
% server.ip)
rest.set_indexer_memoryQuota(indexMemoryQuota=INDEX_QUOTA)
rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
if kv_quota < MIN_KV_QUOTA:
raise Exception("KV RAM need to be more than %s MB"
" at node %s" % (MIN_KV_QUOTA, server.ip))
elif "fts" in set_services and "index" not in set_services:
log.info("quota for fts service will be %s MB" \
% (FTS_QUOTA))
kv_quota = int(info.mcdMemoryReserved * 2/3) - FTS_QUOTA
if kv_quota < MIN_KV_QUOTA:
raise Exception("KV RAM need to be more than %s MB"
" at node %s" % (MIN_KV_QUOTA, server.ip))
""" for fts, we need to grep quota from ns_server
but need to make it works even RAM of vm is
smaller than 2 GB """
rest.set_fts_memoryQuota(ftsMemoryQuota=FTS_QUOTA)
""" set kv quota smaller than 1 MB so that it will satify
the condition smaller than allow quota """
kv_quota -= 1
log.info("quota for kv: %s MB" % kv_quota)
rest.init_cluster_memoryQuota(server.rest_username, \
server.rest_password, \
kv_quota)
if params["version"][:5] in COUCHBASE_FROM_VERSION_4:
rest.init_node_services(username=server.rest_username,
password=server.rest_password,
services=set_services)
rest.init_cluster(username=server.rest_username,
password=server.rest_password)
# Optionally disable consistency check
if params.get('disable_consistency', 0):
rest.set_couchdb_option(section='couchdb',
option='consistency_check_ratio',
#.........这里部分代码省略.........