Kafka broker on AWS - IP setup - amazon-web-services

I have installed Kafka software on EC2. My problem is connecting to broker from outside the AWS. It all work for me from inside.
So I can start the broker, and both kafka-console-producer and consumer works (from the same server). I have ports 2181 and 9092 open to the remote location, towards from where I would like to use producer. So from my development (local) machine .. If I do telnet 9092 - it connects me. If i try to use kafka-console-producer i get this error.
[2017-03-09 15:04:44,971] ERROR Error when sending message to topic topic2 with key: null, value: 5 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for topic2-0: 1521 ms has passed since batch creation plus linger time
I tried all sorts of combination with and on server.properties file - with keys listeners and advertised.listeners.
I would really appreciate some help...

It might be caused by the fact that the public hostname/ip of AWS machines cannot be used inside AWS. If so you need to fudge a bit. 2 things are needed:
make sure you set advertised.listeners to your private address
in your local /etc/hosts, bind the local hostname of aws (eg. ip-10-0-0-1.eu-west-1.compute.internal) to the public IP
Then make sure you always only use the private hostname. This has been the root cause for me of many weird issues not giving any logs.

Related

AzerothCore Unable to connect to server, probably WorldSocket Malformed request sent by client

I am using AzerothCore locally and when I try to log in - I am stuck at "Authenticating".
Previously on login attempt - a error occured, WorldSocket Malformed request sent by client, But after opening the ports for both inbound and outbound connections - it dissapeared.
Therefore, no error message, just stuck at "Authenticating".
Client version: 3.3.5 (13240) (Release)
Jan 24 2010
The realmList is changed to 127.0.0.1:8085 But I am not sure if it is correct, since once I had issues accessing localhost on another application and had to use the router's IP (192.168.0.3)
WorldSocket Malformed request sent by client
WorldSocket::ReadHeaderHandler(): client 111.222.11.22 sent malformed packet (size: 1234, cmd: 3333333)
means some machine anywhere on the planet sent a random portscan to your IP.
Not related to your actual problem.
You should try and set the realmlist to the LAN IP of the machine running the server and do the same in the realmlist table.
Also make sure all ports are properly forwarded to your server. (8085 und 3724 by default).
If both, client and server are running on the same machine, you can use 127.0.0.1. Not otherwise.
Solved:
On the client, use set realmlist 127.0.0.1
Without the port

Cassandra c++ driver keeps attempting reconnection to endpoints that do not exist anymore

I am using Datastax's c++ driver version 2.8.0 for Apache Cassandra inside a kubernetes application. Cassandra is deployed as a 3 node cluster via this Helm chart.
The chart leverages kubernetes' headless services to make the Cassandra endpoints available, so there is an entry in the kubernetes DNS for those endpoints.
I have a c++ app running in a kubernetes pod that interacts with Cassandra, which connects using that DNS entry to resolve the endpoints. The application has a single connection to Cassandra object, following the driver usage guidelines. Connection is initialized at the beginning of the program, and failure to initialize the connection or to execute a query later on will actually fail the program.
Everything is working fine, but cassandra nodes/pods may eventually go down for some reason. When that happens, they're respawned, but get reassigned with a different IP. It seems like the c++ driver is able to get the new endpoints from the DNS without any additional code. However in such a situation the connection is not closed on the client side, and it looks like the previous endpoints remain in the connection pool on some level. This leads to a series of log events similar to the following:
1531920921.161 [WARN] (src/pool.cpp:420:virtual void cass::Pool::on_close(cass::Connection*)): Connection pool was unable to reconnect to host XXX.XXX.XXX.XX because of the following error: Connection timeout
and
1531920921.894 [WARN] (src/pool.cpp:420:virtual void cass::Pool::on_close(cass::Connection*)): Connection pool was unable to reconnect to host XXX.XXX.XXX.XX because of the following error: Connect error 'host is unreachable'
Which pop up every [reconnect timeout]. The more IP reassignments, the more log messages, which as you can guess can get to a pretty large number for long lived applications.
Is there some feature of the driver's API that allows dealing with that? Or a good/recommended way to handle that client side, more generally? One option, external to the driver, could be to reset the connection within the client code, but (although I may be missing out) I fail to see a way to "catch" such events : they only show up in the logs.

Zookeeper unable to listen on port 3888

I've got 3 servers on aws. each with open jdk 7 and zookeeper 3.4.6 all have unique elastic ip's.
each conf/zoo.cfg has
clientPort=2181
server.1=server1:2888:3888
server.2=server2:2888:3888
server.3=server3:2888:3888
then i start it with ./zkServer.sh start (says STARTED)
and the zookeeper.out says
2015-01-14 09:27:55,919 [myid:1] - INFO [Thread-1:QuorumCnxManager$Listener#504] - My election bind port: /server1ipaddress:3888
2015-01-14 09:27:55,920 [myid:1] - ERROR [/server1ipaddress:3888:QuorumCnxManager$Listener#517] - Exception while listening
java.net.BindException: Cannot assign requested address
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:330)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:507)
So it cant open the port.
i've eventually opened all ports on aws security to rule that out.
telnet into 2181 with ruok gets imok.
telnet into 2888 cannot connect. connection refused.
telnet into 3888 cannot connect. connection refused.
netstat shows that nothing is blocking 2888 and 3888
i've even tried this with all 3 servers having zookeeper started.
whats going on? how do i get those ports open for use.
Your problem is answered here.
In a few words: on each ZooKeeper machine, at your conf/zoo.cfg, you have to set the current server's IP to 0.0.0.0.
For example: if you are currently on server1, the config should contain the following lines:
server.1=0.0.0.0:2888:3888
server.2=server2:2888:3888
server.3=server3:2888:3888
This step solved the problem in my case.
Cross verify myid's on all the nodes based on the zoo.cfg. The same issue happened to me, upon looking myid pattern got changed on 2 of the nodes.

filezilla Connection timed out

This might seem like a duplicate question but it is not. I tried to go through similar questions but I couldn't find a fix for my problem. Here is my problem:
I need to set up an ftp connection on company servers.
I can easily connect to ftp server from fileZilla on my PC but when I try it over one of the server machines to the file server all I see is the following:
Response: fzSftp started
Command: open "*****#***.***.***.**" **
Error: Connection timed out
Error: Could not connect to server
Status: Waiting to retry...
Status: Connecting to ***.***.***.**...
Response: fzSftp started
Command: open "*****#***.***.***.**" **
Error: Connection timed out
Error: Could not connect to server
I googled the "Connection timed out"
error and I realized that the first place to check is firewall or router setting. these are outsourced to another company and they say that the issue is solved and it should work fine. I don't know where to look at.
I've had lots of issues with Filezilla. You may try another software first to see if Filezilla itself is the issue.
If you're on Windows, I highly suggest the open source project WinSCP (https://winscp.net/eng/download.php). For Mac, Cyberduck (https://cyberduck.io/?l=en) is solid (and free), though you may prefer Transmit.
I was having this problem after upgrading Filezilla. I downgraded it to a previous version and it worked like charm. I came across this ticket thread and it was absolutely helpful : Filezilla Support Ticket
Check your security group rules. You need a security group rule that allows inbound traffic from your public IP address(Google: What is my ip?) on the proper port.
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, choose Instances, and then select your instance.
In the Description tab, next to Security groups, choose view rules to display the list of rules that are in effect.
For Linux instances: Verify that there is a rule that allows traffic from your computer(public ip) to port 22 (SSH).
For Windows instances: Verify that there is a rule that allows traffic from your computer(public ip) to port 3389 (RDP).
Also take a look at here and here for more details
I need to set up an ftp connection on company servers. I can easily connect to ftp server from fileZilla on my PC but when I try it over one of the server machines to the file server all I see is the following:
<failure to connect code>
Please note that public IP and internel IPs will be a different address; such as 123.456.675.574 for the public but internal to the server network it will be something more like 192.168.10.574 .
This is why you can easily connect from your PC because it uses the public IP address but from the internal IP network of the company servers that address will not be valid, and the internal one would need to be used instead.
Try this, 200 is just an example, just increase it and try.
Edit --> Settings --> Connection --> Timeout in seconds = 200

Micro Cloud Foundry offline mode

during the last week I spent all my time trying to access the MCF in offline mode. I'm working behind a company network (proxy) and the MCF try to do things that conflict with the local network.
I've followed several different tutorials such as 1. Working offline with MCF and 2. Working offline with MCF. But the result keeps the same, even if I change all sort of configuration on my ubuntu.
Trying to set up the target.
vm target http: //api.mycloud.me
HTTP exception: Errno::ECONNREFUSED:Connection refused - connect(2)
The MCF console show the following information:
Identity: mycloud.me (ok)
Admin: admin#mycloud.me
IP address 10.0.x.x (network up / offline)
When I ping to the IP address, I got positive return.
PING 10.0.x.x (10.0.x.x) 56(84) bytes of data.
64 bytes from 10.0.x.x: icmp_req=1 ttl=62 time=1.06 ms
64 bytes from 10.0.x.x: icmp_req=2 ttl=62 time=0.896 ms
64 bytes from 10.0.x.x: icmp_req=3 ttl=62 time=0.880 ms
--- 10.0.2.15 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.880/0.948/1.069/0.089 ms
But if I try to do a telnet to the port 80 or a ssh I got connection refused error.
ssh: connect to host mycloud.me port 22: Connection refused
I don't know what I need to do to fix this, if anyone have a tip that help me to figure out a solution, I'll be very thankful.
Cheers!
OK dudes! That I fixed it!
So, after some problems to understand what was happening, I could finally connect to the Micro Cloud. I'm still validating the information from the two tutorials above, because could have some conflicted data.
I didn't test if it is necessary to set a nameserver to the dhclient, but the second tutorial seems to be more reliable. Just one tip, run the ssh -L tunnel on a separate terminal, and leave it open. This wasn't so clear for people like me, that was not used to working with network administration.
Thanks for the help.
given the assigned IP address, it looks like you are using bridged networking, have you tried changing the VM configuration to use NAT instead?
This will use an interface exclusive to your local machine and the VM and shouldn't be affected by your corporate network.