Hi Udara,

Tried to wait till it pings the hostname from the script before starting
the cassandra with the following line and identified that the hostname is
not getting resolved.

while ! ping -c1 $(hostname) &>>/tmp/hostname.log; do echo "IP is not UP"
>> /tmp/hostname.log  ; sleep 5  ; done

And there is no option of appending the hostname into the '/etc/hosts' as
it is not supported to the docker container.

On Thu, Oct 16, 2014 at 10:10 AM, Udara Liyanage <ud...@wso2.com> wrote:

> Hi Vishanth,
>
> When you ssh into the instance and execute the run script, it works and
> when add as a entry point it does not means there may a difference between
> the users who execute the script. When you ssh and execute, you execute as
> root users.
> @Sajith what is the user who execute the script when you add as an entry
> point.
>
> On Thu, Oct 16, 2014 at 8:06 AM, Vishanth Balasubramaniam <
> vishan...@wso2.com> wrote:
>
>> Hi,
>>
>> There is a problem with starting the cassandra from the Entrypoint at the
>> docker file. BUT it totally works fine when I run the script
>> (run_scripts.sh) inside the instance (ssh root@10.11.12.2).
>>
>> The following line is used in the docker file to call the run script at
>> Entrypoint
>>
>> ENTRYPOINT /usr/local/bin/run_scripts.sh | /usr/sbin/sshd -D
>>
>>
>> run_scripts.sh has the following lines of code to execute
>>
>> #!/bin/bash
>> source /root/.bashrc
>> /usr/local/bin/metadata_svc_bugfix.sh
>> /etc/init.d/apache2 start > /tmp/apache_start.log
>> /root/bin/init.sh > /tmp/init.log &
>> opt/cassandra/bin/start.sh > /tmp/cassandra_start.log &
>>
>>
>> from the run script I am calling the start.sh to start the cassandra,
>> run_script contains the following
>>
>> #setting up the env variables
>> export JAVA_HOME=/opt/java
>> export CASSANDRA_HOME=/opt/cassandra
>> export PATH=$PATH:/opt/cassandra/bin:/opt/java/bin
>> export CASSANDRA_CONF=/opt/cassandra/conf
>> export CLASSPATH=/opt/cassandra/lib/*.jar
>>
>> echo "127.0.0.1 localhost" >> /etc/hosts
>> /opt/cassandra/bin/cassandra
>>
>>
>> The cassandra didn't start at the Entrypoint, then I logged the error
>> into a file using the following line
>> /opt/cassandra/bin/cassandra >> /tmp/cassandra_start.log 2>&1
>>
>> Error: Exception thrown by the agent : java.net.MalformedURLException:
>> Local host name unknown: java.net.UnknownHostException:
>> instance-00000001: instance-00000001
>>
>> Then found the fix from the following discussion
>> http://stackoverflow.com/questions/7496640/problem-on-starting-cassandra
>>
>> and modified the script replacing  echo "127.0.0.1 localhost" >>
>> /etc/hosts with
>> echo "127.0.0.1 localhost.localdomain localhost instance-00000001" >>
>> /etc/hosts
>>
>> But unfortunately I am not able to append the 'hosts' file in etc because
>> it is a read only file.
>>
>> Why is it that it is able to start cassandra inside the instance using
>> the same script but not from calling the script at entrypoint?
>>
>> Herewith I have attached all the Dockerfile, Run_scripts.sh and Start.sh.
>>
>>
>> Thank you
>> --
>> *Vishanth Balasubramaniam*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: *+94771737718*
>> about me: *http://about.me/vishanth <http://about.me/vishanth>*
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 
*Vishanth Balasubramaniam*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware

mobile: *+94771737718*
about me: *http://about.me/vishanth <http://about.me/vishanth>*

Reply via email to