Before assigning a port to a server, there is a useful command to see what process is running on a specific port (in this case, the port 9093):
> lsof -i :9093
The output of the previous command is something like this:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 17479 admin 97u IPv6 0xcfbcde96aa59c3bf 0t0 TCP *:9093 (LISTEN)
Try to run this command before starting the Kafka servers and run it after starting to see the change. Also, try to start a broker on a port in use to see how it fails.
To run Kafka nodes on different machines, change the ZooKeeper connection string in the configuration file; its default value is:
zookeeper.connect=localhost:2181
This value is correct only if you are running the Kafka broker on the same machine as Zookeeper. In production, it could not happen. To specify that ZooKeeper is running on different machines (that is, in a ZooKeeper cluster), set:
zookeeper.connect=localhost:2181, 192.168.0.2:2183, 192.168.0.3:2182
The previous line says that Zookeeper is running on the localhost machine on port 2181, on the machine with IP Address 192.168.0.2 on port 2183, and on the machine with IP Address 192.168.0.3 on port 2182. The Zookeeper default port is 2181, so try to run it there.
As an exercise, try to raise a broker with incorrect information about Zookeeper. Also, in combination with the lsof command, try to raise Zookeeper on a port in use.