Question: Kafka broker is 10.2.1.

This works:

```
$ ssh me@jumpbox
me@jumpbox:~$ kafka-console-consumer.sh --bootstrap-server \
                                          "10.200.1.1:9092,10.200.1.2:9092" \
                                        --topic "mytopic"

```

This doesn't:

```
$ ssh me@jumpbox -L 9998:10.200.1.1:9092 \
                 -L 9999:10.200.1.2:9092

### in a new terminal:

$ kafka-console-consumer --bootstrap-server "localhost:9998,localhost:9999" \
                         --topic "mytopic"

```

Why not?

Answer: 
Because kafka broker will redirect the consumer to use the original hosts. See this, <https://stackoverflow.com/questions/45854168/consume-from-a-kafka-cluster-through-ssh-tunnel>
It took me a couple of hours to sort this out. The good thing is the solution turned out is easy

My senario is

1. I have a Kafaka server on centos in AWS running at 10.155.10.2:9092
2. 10.155.10.2:22 is open for SSH with a centos RSA key access

My target is
Using kafka-node to produce messages to 10.155.10.2:9092 through SSH tunnel (port 22) from my win10

initial efforts

1. open a cmd window in my win 10 and run
ssh -i pathToMykeyFile -L 9092:10.155.10.2:9092 ssh\_user@10.155.10.2
leave this cmd window open
2. use the below in nodejs
const client = new kafka.KafkaClient({ kafkaHost: 'localhost:9092 })
...
producer.send(...)...

result:
request timeout

pitfall:
Kakfka will return a broker address to connect to instead ofu sing localhost:9092 straigh away, the actual broker address retuned is like broker-ip-hostname
the return broker address I got is "ip-10-155-10-2.ap-southeast-2.compute.internal"
I had to dig into kafka-node's source code to find it out

solution:
add the below to C:\Windows\System32\drivers\etc\hosts after you find out the actual broker address
127.0.0.1 ip-10-155-10-2.ap-southeast-2.compute.internal