Why Datanode is Denied Communication With Namenode

So for those trying to setup HDFS out there, and are struggling with this kind of error where it said datanode denied communication with namenode:

2015-05-07 08:04:19,694 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Block pool BP-1184863888-172.17.0.3-1430984962919 (Datanode Uuid null) service to dockernamenode.zanox.com/172.17.0.3:8020 beginning handshake with NN
2015-05-07 08:04:19,697 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool BP-1184863888-172.17.0.3-1430984962919 (Datanode Uuid null) service to dockernamenode.zanox.com/172.17.0.3:8020 Datanode denied communication with namenode because hostname cannot be resolved (ip=172.17.0.5, hostname=172.17.0.5): DatanodeRegistration(0.0.0.0, datanodeUuid=f8c97ad9-3cb3-49a1-9e4e-bc2341779f19, infoPort=50075, ipcPort=50020, storageInfo=lv=-56;cid=CID-9ab30cb5-ada8-4201-9d94-6400e83af6e4;nsid=1471492370;c=0)
    at org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.registerDatanode(DatanodeManager.java:904)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.registerDatanode(FSNamesystem.java:5042)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.registerDatanode(NameNodeRpcServer.java:1069)
    at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB.registerDatanode(DatanodeProtocolServerSideTranslatorPB.java:92)
    at org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos$DatanodeProtocolService$2.callBlockingMethod(DatanodeProtocolProtos.java:27329)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:619)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:1060)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2044)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2040)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1671)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2038)

It could actually be because of many configurations problem, but in the end it boils to one thing and that’s what I am going to tell you. It costed me one day just to fix this problem when I was running test-kitchen to provision hadoop servers.

Read more →

The Difference between For-Each Loop and forEach()

People who have played enough with the brand new Java 8 will be familiar with the new forEach(fn(x)) loop in lambda. This syntax is quite popular among developers because it’s easier and prettier to use than the normal For-Each loop. It is also popular in other languages, especially JavaScript.

The problem is, I’ve seen a very specific bug, which is related to this “functional” forEach() loop, quite a few times, again and again. People tend to think that these two kinds of loop are 100% identical, which is not. Although Java 8’s type-safety make it harder for people to make this mistake because of its compilation error, it’s still not 100% safe.

Read more →

Java 8 - Turning off SSL Certificate Check

There’s usually no good reason to turn off SSL certificate check. So this is actually wrong in many ways, but maybe we’re still developing in an isolated dev environment and somehow the dev machine of another application you’re depending on only allows SSL connection even though it doesn’t have a valid certificate. The correct solution is actually to self sign a certificate or add it in the system, so that if your application go live, you will still have ssl certificate check turned on. If not, you might forgot to turn the ssl certificate check back on when launching the stuff and it will be bad. So, use this on your own risk.

Read more →

AWS Eb CLI (v3): How to fix ssl_wrap_socket error in Debian Jessie

This is the first time I’m deploying stuff to elasticbeanstalk, and when I’m trying to deploy my private project, I realized the eb cli I download is the version 2 and has different syntax. I installed the version 3, and it seems like it can only be installed using python package manager pip. After installing it, this is what I get:

rowanto@Rowanto-Deb ~ $ eb
Traceback (most recent call last):
  File "/usr/local/bin/eb", line 9, in <module>
    load_entry_point('awsebcli==3.0.10', 'console_scripts', 'eb')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 519, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2630, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2310, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2316, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/ebcore.py", line 23, in <module>
    from ..controllers.initialize import InitController
  File "/usr/local/lib/python2.7/dist-packages/ebcli/controllers/initialize.py", line 16, in <module>
    from ..core.abstractcontroller import AbstractBaseController
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/abstractcontroller.py", line 21, in <module>
    from ..core import io, fileoperations, operations
  File "/usr/local/lib/python2.7/dist-packages/ebcli/core/operations.py", line 25, in <module>
    from ..lib import elasticbeanstalk, s3, iam, aws, ec2, elb
  File "/usr/local/lib/python2.7/dist-packages/ebcli/lib/elasticbeanstalk.py", line 25, in <module>
    from ..lib import aws
  File "/usr/local/lib/python2.7/dist-packages/ebcli/lib/aws.py", line 17, in <module>
    import botocore_eb.session
  File "/usr/local/lib/python2.7/dist-packages/botocore_eb/session.py", line 27, in <module>
    import botocore_eb.credentials
  File "/usr/local/lib/python2.7/dist-packages/botocore_eb/credentials.py", line 27, in <module>
    from botocore_eb.utils import InstanceMetadataFetcher, parse_key_val_file
  File "/usr/local/lib/python2.7/dist-packages/botocore_eb/utils.py", line 22, in <module>
    from botocore_eb.vendored import requests
  File "/usr/local/lib/python2.7/dist-packages/botocore_eb/vendored/requests/__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/botocore_eb/vendored/requests/packages/urllib3/contrib/pyopenssl.py", line 55, in <module>
    orig_connectionpool_ssl_wrap_socket = connectionpool.ssl_wrap_socket
AttributeError: 'module' object has no attribute 'ssl_wrap_socket'
rowanto@Rowanto-Deb ~ $ 

And I’m like, what? Googling around the last line returns you many result, but not those relevant with the eb cli v3. There’s also a post which suggest that we use the bundle version (it’s a zip file) of aws cli, but I can’t find a bundle version of eb cli. Long story short, I found this post which helped me to fix the problem. Thanks to @guss77!

Read more →

How Positive Thinking and Negative Thinking Could Go Wrong

Pretty much every people who I met understood the concept of positive thinking wrong. Usually what happens is, they are confronted with a problem, and they will say, “Don’t worry. Everything will be fine”. Afterwards, they said it’s positive thinking. The problem here is, we have a problem in front of us, so how is everything fine? The problem will not magically go away. We have to deal with it. Let’s have another example. Deadline is in one week, and there’s still three week’s worth of work. One of your colleague said, “Don’t worry. We will make it.”. This might sounds ok at first, but it’s actually denying the truth, and it’s giving false hope to the other colleagues.

Read more →

How to fix libgdbm3 update problem in Debian

In case you recently tried to update your debian system, and got an error related to libgdbm3 like this:

Preparing to unpack .../libgdbm3_1.8.3-13+b1_i386.deb ...
Unpacking libgdbm3:i386 (1.8.3-13+b1) over (1.8.3-13) ...
dpkg: error processing archive /var/cache/apt/archives/libgdbm3_1.8.3-13+b1_i386.deb (--unpack):
 trying to overwrite shared '/usr/share/doc/libgdbm3/changelog.Debian.gz', which is different from other instances of package libgdbm3:i386
Errors were encountered while processing:
 /var/cache/apt/archives/libgdbm3_1.8.3-13+b1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

You can fix this easily by deleting the libdgbm3 changelog file.

Read more →

Lessons learned in Øredev 2014

Recently I visited the Øredev 2014 conference. I must say that it’s a pretty good one. Some of the talks are pretty boring, but most of them are actually pretty nice.

I was in the security training, and the three days conference. I tried to avoid going to the talks whose content I can just read up somewhere in the internet. I want the experiences from the speakers. That’s why if you see the points below, most of them is about how to do something best. Sometimes I don’t really have much choices, but when something like that happened, I will just switch rooms randomly. :)

Read more →

Add automatic code or syntax highlighting in your ghost blog

Recently, I switched to the Ghost blogging platform. I must say that it’s actually quite nice. Well, it’s still young, and some stuff needs to be taken care of. You need to use “forever” or an init.d script and monitoring to make sure it will stay running. You have to take care of setting up the mail service because it still can’t do it automatically like other platform, etc, etc. Well, you can also pay them to host it for you and forgot all those stuffs though.

Read more →

Why your cancel button submit the html form

One of the mistake which I see often during development on the frontend side is the cancel button, which actually submits the form when clicked. Saw it once, wait a while, saw it again, wait a while, saw it again, and the loop continues. Some people doesn’t even realize.

So what’s the problem? Let’s take a look at a normal html form in AngularJS. HTML Code

<div ng-app="MyApp">
    <div ng-controller="MyController">
    <form ng-submit="submitTheForm()">
        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" class="form-control" ng-model="someone.name" id="name" placeholder="Enter name"></input>
        </div>
        <button class="btn btn-default" ng-click="cancel()">Cancel</button>
        <button type="submit" class="btn btn-default">Submit</button>
    </form>
    </div>
</div>

JavaScript Code

Read more →

Playing with AWS Redshift - Sum of 1.2 billion rows took 8 seconds

One of the think which makes zanox. an exciting place to work at is because of the innovation time. We used to always have 20% of our work time to be innovation time, where we can learn new stuff which makes life a whole lot interesting. About a month before the writing of this, the format of the innovation time was changed, instead of doing whatever we want on friday, we need to make it transparent what we’re learning, and the company will support them by giving you the required stuff. And that’s when we got the idea with redshift.

Read more →