免费资源网 – https://freexyz.cn/
docker compose 配置
假设有两台电脑
A电脑的ip为192.168.1.100
B电脑的ip为192.168.1.103
A电脑的docker compose 配置version: 3 services: cassandra: restart: always image: cassandra:3.11.10 hostname: cassandra1 container_name: cassandra-node-1 environment: – CASSANDRA_BROADCAST_ADDRESS=cassandra1 – CASSANDRA_SEEDS=cassandra1,cassandra3 extra_hosts: – “cassandra1:192.168.1.100” – “cassandra3:192.168.1.103” ports: – “9042:9042” – “7000:7000” volumes: – cassandra_data:/var/lib/cassandra volumes: cassandra_data:B电脑的docker compose 配置
version: 3 services: cassandra: restart: always image: cassandra:3.11.10 hostname: cassandra3 container_name: cassandra-node-3 environment: – CASSANDRA_BROADCAST_ADDRESS=cassandra3 – CASSANDRA_SEEDS=cassandra1,cassandra3 extra_hosts: – “cassandra1:192.168.1.100” – “cassandra3:192.168.1.103” ports: – “9042:9042” – “7000:7000” volumes: – cassandra_data:/var/lib/cassandra volumes: cassandra_data:设置内存
临时
sysctl -w vm.max_map_count=262144永久
Disable memory paging and swapping performance on the host to improve performance.
禁用主机上的内存分页和交换性能以提高性能。
ps:这个看情况,内存大的话,也可以关掉 sudo swapoff -aIncrease the number of memory maps available to OpenSearch.
增加OpenSearch可用的内存映射数量。# Edit the sysctl config file sudo vi /etc/sysctl.conf # Add a line to define the desired value # or change the value if the key exists, # and then save your changes. vm.max_map_count=262144 # Reload the kernel parameters using sysctl sudo sysctl -p # Verify that the change was applied by checking the value cat /proc/sys/vm/max_map_count两边同时启动
docker compose up -d查看集群状态
#在A机器pingB机器 docker exec -ti cassandra-node-1 cqlsh -u cassandra -pcassandra cassandra3 -e “DESCRIBE CLUSTER”返回
Cluster: Test Cluster Partitioner: Murmur3Partitioner连接成功,可以使用数据库连接工具插入一条数据,分别连入A和B的数据库,查看数据是否一致
© 版权声明
THE END
暂无评论内容