准备T1,T2,T3,T4
4台服务器
T1=192.168.68.17 T2=192.168.68.18 T3=192.168.68.20 T4=192.168.68.21
Sender集群: T1,T2
Receiver集群: T3,T4
在各个服务器上创建 /opt/geode_work/
目录
cd /opt/geode_work/
执行gfsh
#启动locator1
start locator --name=locator1 --port=10334 --locators=T1[10334] \
--initial-heap=1G --max-heap=8G \
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--J=-Dgemfire.distributed-system-id=101 \
--J=-Dgemfire.remote-locators=T3[10334]
#启动server1
start server --name=server1 --locator-wait-time=120 --server-port=40401 --locators=T1[10334] \
--initial-heap=16G --max-heap=16G --J=-Xmn8g\
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--off-heap-memory-size=32G --lock-memory=true --critical-off-heap-percentage=90 --eviction-off-heap-percentage=80 \
--J=-Dgemfire.distributed-system-id=101 \
--J=-Dgemfire.remote-locators=T3[10334]
#等待server2启动后再执行
create gateway-sender --id=sender1 --enable-persistence=true --manual-start=false --parallel=true --remote-distributed-system-id=102
#然后执行:list gateways 来查看状态
#创建region1
create region --name=region1 --type=PARTITION_REDUNDANT_PERSISTENT --redundant-copies=1 --off-heap=true \
--enable-statistics=true --entry-time-to-live-expiration=600 --entry-time-to-live-expiration-action=destroy \
--gateway-sender-id=sender1
cd /opt/geode_work/
执行gfsh
#启动server2
start server --name=server2 --locator-wait-time=120 --server-port=40401 --locators=T1[10334] \
--initial-heap=16G --max-heap=16G --J=-Xmn8g\
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--off-heap-memory-size=32G --lock-memory=true --critical-off-heap-percentage=90 --eviction-off-heap-percentage=80 \
--J=-Dgemfire.distributed-system-id=101 \
--J=-Dgemfire.remote-locators=T3[10334]
进入工作目录cd /opt/geode_work/
执行gfsh
#启动locator3
start locator --name=locator3 --port=10334 --locators=T3[10334] \
--initial-heap=1G --max-heap=8G \
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--J=-Dgemfire.distributed-system-id=102
#启动server3
start server --name=server3 --locator-wait-time=120 --server-port=40401 --locators=T3[10334] \
--initial-heap=16G --max-heap=16G --J=-Xmn8g\
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--off-heap-memory-size=32G --lock-memory=true --critical-off-heap-percentage=90 --eviction-off-heap-percentage=80 \
--J=-Dgemfire.distributed-system-id=102
#等待server4启动后再执行
create gateway-receiver --start-port=1530 --end-port=1551
#然后执行:list gateways 来查看状态
#创建region1(要跟sender端的名字一样)
create region --name=region1 --type=PARTITION_REDUNDANT_PERSISTENT --redundant-copies=1 --off-heap=true \
--enable-statistics=true --entry-time-to-live-expiration=600 --entry-time-to-live-expiration-action=destroy
cd /opt/geode_work/
执行gfsh
#启动server4
start server --name=server4 --locator-wait-time=120 --server-port=40401 --locators=T3[10334] \
--initial-heap=16G --max-heap=16G --J=-Xmn8g\
--J=-Dgemfire.max-num-reconnect-tries=100 --J=-Dgemfire.member-timeout=120000 \
--off-heap-memory-size=32G --lock-memory=true --critical-off-heap-percentage=90 --eviction-off-heap-percentage=80 \
--J=-Dgemfire.distributed-system-id=102
#web管理地址
http://192.168.68.17:7070/pulse/
#进入工作目录
cd /opt/geode_work
#查找geode进程
ps -ef | grep geode | grep -v grep
#连接到集群并执行多个命令
gfsh -e "connect" -e "list members"
gfsh -e "connect" -e "list gateways"
#在gfsh里执行停止集群命令
gfsh>shutdown --include-locators=true --time-out=60