Run on ec2

classic Classic list List threaded Threaded
3 messages Options
plj
Reply | Threaded
Open this post in threaded view
|

Run on ec2

plj
Howdy,

  I'm trying to run NiFi on an ec2 instance. In nifi.properties if I leave blank
nifi.web.http.host=
and
nifi.remote.input.socket.host=

I get in the log nifi-bootstrap.log:
2016-01-22 14:57:06,592 WARN [main] org.apache.nifi.bootstrap.RunNiFi Failed to obtain hostname for notification due to:
java.net.UnknownHostException: ip-172-16-6-26: ip-172-16-6-26: unknown error
        at java.net.InetAddress.getLocalHost(InetAddress.java:1505) ~[na:1.8.0_65]
        at org.apache.nifi.bootstrap.RunNiFi.getHostname(RunNiFi.java:765) [nifi-bootstrap-0.4.1.jar:0.4.1]
        at org.apache.nifi.bootstrap.RunNiFi.start(RunNiFi.java:947) [nifi-bootstrap-0.4.1.jar:0.4.1]
        at org.apache.nifi.bootstrap.RunNiFi.main(RunNiFi.java:200) [nifi-bootstrap-0.4.1.jar:0.4.1]

If I put in the hosts name or the ip address for the host I get the same thing.  

Any thoughts on what i'm doing wrong?

thank you,

Patrick Jones

Reply | Threaded
Open this post in threaded view
|

Re: Run on ec2

Matthew Clarke
EC2 instances have a public facing Hostname and IP and a private facing
Hostname and IP.  My thought is that you are using the public facing
hostname or IP.  The problem there is that public facing hostname or IP
will not match up with the only hostname and IP Java sees associated with
that instance.  Try setting the value of both nifi.web.http.host= and
nifi.remote.input.socket.host=
to the public facing hostname and adding an entry to your EC2 instances
/etc/hosts file that resolves that public facing hostname to the private IP
assigned to the EC2 instance

for example:

172-31-xxx-xxx    ec2-52-x-x-x.us-west-2.compute.amazonaws.com

Thanks,
Matt

On Fri, Jan 22, 2016 at 9:30 AM, plj <[hidden email]> wrote:

> Howdy,
>
>   I'm trying to run NiFi on an ec2 instance. In nifi.properties if I leave
> blank
> nifi.web.http.host=
> and
> nifi.remote.input.socket.host=
>
> I get in the log nifi-bootstrap.log:
> 2016-01-22 14:57:06,592 WARN [main] org.apache.nifi.bootstrap.RunNiFi
> Failed
> to obtain hostname for notification due to:
> java.net.UnknownHostException: ip-172-16-6-26: ip-172-16-6-26: unknown
> error
>         at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
> ~[na:1.8.0_65]
>         at org.apache.nifi.bootstrap.RunNiFi.getHostname(RunNiFi.java:765)
> [nifi-bootstrap-0.4.1.jar:0.4.1]
>         at org.apache.nifi.bootstrap.RunNiFi.start(RunNiFi.java:947)
> [nifi-bootstrap-0.4.1.jar:0.4.1]
>         at org.apache.nifi.bootstrap.RunNiFi.main(RunNiFi.java:200)
> [nifi-bootstrap-0.4.1.jar:0.4.1]
>
> If I put in the hosts name or the ip address for the host I get the same
> thing.
>
> Any thoughts on what i'm doing wrong?
>
> thank you,
>
> Patrick Jones
>
>
>
>
>
> --
> View this message in context:
> http://apache-nifi-developer-list.39713.n7.nabble.com/Run-on-ec2-tp6664.html
> Sent from the Apache NiFi Developer List mailing list archive at
> Nabble.com.
>
plj
Reply | Threaded
Open this post in threaded view
|

Re: Run on ec2

plj
Thanks for the quick response.

I solved the problem by following the advice @
http://deploymentzone.com/2014/01/06/aws-instances-and-java-net-unknownhostexception/

I modified my /etc/hosts file

#!/bin/bash

HOSTNAME=`hostname`  
ETC_HOSTS=${1:-/etc/hosts}  
if ! grep $HOSTNAME $ETC_HOSTS > /dev/null ; then  
    if grep "127.0.0.1" $ETC_HOSTS > /dev/null ; then
        sed -i "s/127\.0\.0\.1.*$/& $HOSTNAME/" $ETC_HOSTS
    else
        echo "127.0.0.1 localhost $HOSTNAME" >> $ETC_HOSTS
    fi
fi


thank you,

Patrick Jones