You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
538 B
19 lines
538 B
3 years ago
|
import os
|
||
|
|
||
|
from .redis_ import Redis
|
||
|
import jury
|
||
|
|
||
|
|
||
|
class Cluster:
|
||
|
def __init__(self, num=3):
|
||
|
self.nodes = []
|
||
|
self.num = num
|
||
|
for i in range(num):
|
||
|
self.nodes.append(Redis(args=["--cluster-enabled", "yes"]))
|
||
|
host_port_list = [f"{node.host}:{node.port}" for node in self.nodes]
|
||
|
jury.log_yellow(f"Redis cluster created, {self.num} nodes. {host_port_list}")
|
||
|
os.system("redis-cli --cluster-yes --cluster create " + " ".join(host_port_list))
|
||
|
|
||
|
def push_table(self):
|
||
|
pass
|