Skip to content

Commit

Permalink
使用太记桌面版同步
Browse files Browse the repository at this point in the history
  • Loading branch information
Gezi-lzq committed Jun 28, 2024
1 parent 22d2aff commit 4cf88dc
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
created: 20200408112506281
creator: 林一二
modified: 20240531182652843
modified: 20240628061506119
modifier: Gezi-lzq
title: $:/themes/tiddlywiki/vanilla/metrics/sidebarwidth
type: text/vnd.tiddlywiki

26.14373439728959vw
28.003800374465044vw
83 changes: 83 additions & 0 deletions tiddlers/RocketMQ单节点启动流程.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
created: 20240628061511922
creator: Gezi-lzq
modified: 20240628063131670
modifier: Gezi-lzq
tags: RocketMQ
title: RocketMQ单节点启动流程
type: text/vnd.tiddlywiki

! 安装JDK环境

执行命令:

```bash
sudo yum install java-11-amazon-corretto-devel -y
```

! 下载RocketMQ

访问版本列表:[[RocketMQ Download|https://rocketmq.apache.org/download/]]

下载所需版本的RocketMQ,例如:

```bash
wget https://archive.apache.org/dist/rocketmq/4.9.7/rocketmq-all-4.9.7-bin-release.zip
```

! 解压RocketMQ压缩包

执行命令:

```bash
unzip rocketmq-all-4.9.7-bin-release.zip
```

! 修改内存设置

编辑 `ROCKETMQ_HOME/bin/runserver.sh` 和 `ROCKETMQ_HOME/bin/runbroker.sh` 文件,根据实际需求调整JVM内存参数,在 `JAVA_OPT` 中修改内存设置。

! 设置环境变量

编辑 `/etc/profile` 文件,添加 `ROCKETMQ_HOME` 环境变量,例如:

```bash
export ROCKETMQ_HOME=/path/to/rocketmq-folder
```
使环境变量生效:

```bash
source /etc/profile
```

! 修改Broker配置文件 `broker.conf`

* 设置 `namesrvAddr` 为NameServer地址,多个地址用逗号分隔
* 设置 `brokerClusterName` 为所属集群名称
* 设置 `brokerName` 为Broker名称,Master和Slave使用相同名称表示主从关系
* 设置 `brokerId`,0表示Master,大于0表示Slave
* 设置 `deleteWhen` 为消息删除时间,默认凌晨4点
* 设置 `fileReservedTime` 为磁盘上保留消息的时长,单位为小时
* 设置 `brokerRole` 为【SYNC_MASTER,ASYNC_MASTER,SLAVE】之一,表示同步或异步Master与Slave数据同步机制
* 设置 `flushDiskType` 为【ASYNC_FLUSH,SYNC_FLUSH】之一,表示同步或异步刷盘策略
* 设置 `listenPort` 为Broker监听的端口号
* 设置 `storePathRootDir` 为存储消息的根目录
* 设置 `storePathCommitLog` 为CommitLog的存储路径
* 设置 `brokerIP1` 为Broker的监听IP地址

! 启动RocketMQ

* 启动NameServer:

```bash
nohup sh mqnamesrv &
```

* 启动Broker:

```bash
nohup sh bin/mqbroker -n localhost:9876 &
```

如果需要指定配置文件,则在命令中加入 `-c /path/to/broker.conf`

确保在启动Broker之前NameServer已经启动并运行。完成以上步骤后,RocketMQ应当成功启动并准备好接收和处理消息。

0 comments on commit 4cf88dc

Please sign in to comment.