一、ubuntu配置静态ip
1、查询网卡的名称
ifconfig
2、修改配置文件
sudo vi /etc/network/interfaces
修改内容如下
auto eth0 #其中eth0是步骤1中确定的网卡名字
iface eth0 inet static
address x.x.x.x #x.x.x.x为设置的静态ip地址
netmask 255.255.255.0 #此处设置子网掩码
gateway x.x.x.x #此处设置网关
dns-nameservers 8.8.8.8 #此处设置dns服务器 mcli dev show 查看ip
修改完成后,执行sudo ip addr flush eth0 或者重启网卡服务或者重启服务器
二、ubuntu安装kafka
1.安装zookeeper
1) 手动下载地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.7.0/
使用wget:wget https://archive.apache.org/dist/zookeeper/zookeeper-3.7.0/apache-zookeeper-3.7.0-bin.tar.gz
2) tar -zxvf apache-zookeeper-3.7.0-bin.tar.gz
3)解压后进入cd apache-zookeeper-3.7.0-bin/
4)然后进入conf执行:mv zoo_sample.cfg zoo.cfg
5)然后退出conf,进入bin文件执行 ./zkServer.sh start 一般都能启动成功
6)默认端口是8080,如果启动失败执行下面命令查看启动失败原因 ./zkServer.sh start-foreground
2.安装kafka
1)下载 wget https://downloads.apache.org/kafka/3.2.3/kafka_2.13-3.2.3.tgz
2) 解压 tar -zxvf kafka_2.13-3.2.3.tgz
3)启动kafka bin/kafka-server-start.sh config/server.properties 或者
启动kafka命令:systemctl start kafka