Kafka 命令行操作
时间: 2023-07-11 20:26:14 浏览: 61
}
void EnterWorkingMode(void)
{
// TODO: Add code to enter working mode
}
void WriteAddrData(uint16_t addr,K 命令行操作包括以下几个方面:
1. 创建主题:使用 kafka-topics.sh 脚本创建主题 uint8_t data)
{
HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, EEPROM_BASE_ADDR + addr, data);
}
uint8,例如:
```
./kafka-topics.sh --create --topic my-topic --zookeeper localhost:2181 --replication-factor 1 --partitions 1
```
2. 查看主题:使用 kafka-topics.sh 脚本查看主题信息,_t ReadAddrData(uint16_t addr)
{
return (*((uint8_t *) (EEPROM_BASE_ADDR + addr)));
}
void DetectB例如:
```
./kafka-topics.sh --describe --topic my-topic --zookeeper localhost:2181
```
3. 生ottlePosition(uint16_t addr)
{
uint8_t AddrData = AddrList[addr];
uint8_t BottleDetect = HAL_GPIO产消息:使用 kafka-console-producer.sh 脚本生产消息,例如:
```
./kafka-console-producer.sh --broker-list_ReadPin(BOTTLE_DETECT_GPIO_PORT, BOTTLE_DETECT_GPIO_PIN);
if (BottleDetect == AddrData)
{
localhost:9092 --topic my-topic
```
4. 消费消息:使用 kafka-console-consumer.sh 脚本消费消息, // Correct bottle position, blink LED 3 times
for (uint8_t i = 0; i < 3; i++)
例如:
```
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic my-topic --from-beginning
```
{
HAL_GPIO_WritePin(LED_GPIO_PORT, LED_GPIO_PIN, GPIO_PIN_RESET);
HAL_Delay(100);
HAL_GPIO_Write5. 查看消费者组:使用 kafka-consumer-groups.sh 脚本查看消费者组信息,例如:
```
./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
```
6. 查看消费者组消费Pin(LED_GPIO_PORT, LED_GPIO_PIN, GPIO_PIN_SET);
HAL_Delay(100);
}
}
else
{
情况:使用 kafka-consumer-groups.sh 脚本查看消费者组消费情况,例如:
```
./kafka // Incorrect bottle position, blink LED 3 times
for (uint8_t i = 0; i < 3; i++)
{
HAL_GPIO_WritePin(LED_GPIO_PORT, LED_GPIO_PIN, GPIO_PIN_RESET);
HAL_Delay(500);
HAL_GPIO_Write-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-group
```
以上是 Kafka 命令行操作的基本内容,使用时需要注意参数的设置。