def __init__(self, *args, **kwargs): num_servers = kwargs.pop("num_servers", getattr(self, "NUM_SERVERS", self.DEFAULT_NUM_SERVERS)) super(GracefulStopTest, self).__init__(*args, **kwargs) self.crates = [] self.clients = [] self.node_names = [] # auto-discovery with unicast on the same host only works if all nodes are configured with the same port range transport_port_range = GLOBAL_PORT_POOL.get_range(range_size=num_servers) for i in range(num_servers): layer = GracefulStopCrateLayer( self.node_name(i), crate_path(), host='localhost', port=GLOBAL_PORT_POOL.get(), transport_port=transport_port_range, settings={ # The disk.watermark settings can be removed once crate-python > 0.21.1 has been released "cluster.routing.allocation.disk.watermark.low": "100k", "cluster.routing.allocation.disk.watermark.high": "10k", "cluster.routing.allocation.disk.watermark.flood_stage": "1k", }, cluster_name=self.__class__.__name__) client = Client(layer.crate_servers) self.crates.append(layer) self.clients.append(client) self.node_names.append(self.node_name(i)) self.layer = CascadedLayer( "{0}_{1}_crates".format(self.__class__.__name__, num_servers), *self.crates )
def setUp(self): self.crates = [] self.clients = [] self.node_names = [] # auto-discovery with unicast on the same host only works if all nodes are configured with the same port range transport_port_range = bind_range(range_size=self.num_servers) for i in range(self.num_servers): layer = GracefulStopCrateLayer( self.node_name(i), crate_path(), host='localhost', port=bind_port(), transport_port=transport_port_range, settings={ # The disk.watermark settings can be removed once crate-python > 0.21.1 has been released "cluster.routing.allocation.disk.watermark.low": "100k", "cluster.routing.allocation.disk.watermark.high": "10k", "cluster.routing.allocation.disk.watermark.flood_stage": "1k", }, env=os.environ.copy(), cluster_name=self.__class__.__name__) layer.start() self.clients.append(Client(layer.crate_servers)) self.crates.append(layer) self.node_names.append(self.node_name(i)) client = self.random_client() num_nodes = 0 # wait until all nodes joined the cluster while num_nodes < len(self.crates): response = client.sql("select * from sys.nodes") num_nodes = response.get("rowcount", 0) time.sleep(.5)
def setUp(self): self.crates = [] self.clients = [] self.node_names = [] # auto-discovery with unicast on the same host only works if all nodes are configured with the same port range transport_port_range = bind_range(range_size=self.num_servers) for i in range(self.num_servers): layer = GracefulStopCrateLayer( crate_dir=crate_path(), settings={ 'cluster.name': self.__class__.__name__, 'node.name': self.node_name(i), 'transport.tcp.port': transport_port_range, }, env={ **os.environ.copy(), 'CRATE_HEAP_SIZE': '256M' }, version=(4, 0, 0) ) layer.start() self.clients.append(Client(layer.http_url)) self.crates.append(layer) self.node_names.append(self.node_name(i)) client = self.random_client() num_nodes = 0 # wait until all nodes joined the cluster while num_nodes < len(self.crates): response = client.sql("select * from sys.nodes") num_nodes = response.get("rowcount", 0) time.sleep(.5)
def __init__(self, *args, **kwargs): num_servers = kwargs.pop( "num_servers", getattr(self, "NUM_SERVERS", self.DEFAULT_NUM_SERVERS)) super(GracefulStopTest, self).__init__(*args, **kwargs) self.crates = [] self.clients = [] self.node_names = [] # auto-discovery with unicast on the same host only works if all nodes are configured with the same port range transport_port_range = GLOBAL_PORT_POOL.get_range( range_size=num_servers) for i in range(num_servers): layer = GracefulStopCrateLayer( self.node_name(i), crate_path(), host='localhost', port=GLOBAL_PORT_POOL.get(), transport_port=transport_port_range, cluster_name=self.__class__.__name__) client = Client(layer.crate_servers) self.crates.append(layer) self.clients.append(client) self.node_names.append(self.node_name(i)) self.layer = CascadedLayer( "{0}_{1}_crates".format(self.__class__.__name__, num_servers), *self.crates)
def __init__(self, *args, **kwargs): num_servers = kwargs.pop("num_servers", getattr(self, "NUM_SERVERS", self.DEFAULT_NUM_SERVERS)) super(GracefulStopTest, self).__init__(*args, **kwargs) self.crates = [] self.clients = [] self.node_names = [] for i in range(num_servers): layer = GracefulStopCrateLayer(self.node_name(i), crate_path(), host=public_ip(), port=random_available_port(), transport_port=random_available_port(), multicast=True, cluster_name=self.__class__.__name__) client = Client(layer.crate_servers) self.crates.append(layer) self.clients.append(client) self.node_names.append(self.node_name(i)) self.layer = CascadedLayer( "{0}_{1}_crates".format(self.__class__.__name__, num_servers), *self.crates )