sequenceiq / docker-ambari

Docker image with Ambari
291 stars 201 forks source link

Best way to deploy with java 8 #119

Open rmelick opened 8 years ago

rmelick commented 8 years ago

What's the best way to start up a cluster with java 8 instead of java 7? HDP Ambari documentation (https://docs.hortonworks.com/HDPDocuments/Ambari-2.2.0.0/bk_ambari_reference_guide/content/ch_changing_the_jdk_version_on_an_existing_cluster.html) suggests using ambari-server setup, but I haven't been able to get that working in an automated way.

I noticed that the ambari-base Dockerfile manually downloads a specific jdk. Is there a reason this was required? Any suggestions for how we could extend the ambari-base of ambari-server/agent Dockerfiles to install java 8 before startup?

lalyos commented 8 years ago

The jdk is preinstalled, in order to speed up startup time. Right now the official ambari release is using the sepcific 1.7.0_67 version.

There are some security related issues reported with java8, so right now we provide only java7.

However if you want to experiment with java 8 you can build the docker images locally:

Just change 2 Lines in ambar-base/Dockerfile

ENV JDK_ARTIFACT jdk-8u60-linux-x64.tar.gz
ENV JDK_VERSION jdk1.8.0_60

Than from the ambari-base dir execute a: docker build -t hortonworks/ambari-base . After that do the same for ambari-agent and ambari-server images

rmelick commented 8 years ago

Thanks @lalyos. We're trying to build Dockerfiles based on ambari-server and ambari-agent with FROM, instead of copying them and replacing some params.

I've gotten it to work sort of by putting the following into our Dockerfile

# install java 8
ENV JDK_ARTIFACT jdk-8u60-linux-x64.tar.gz
ENV JDK_VERSION jdk1.8.0_60
RUN cd /usr/jdk64 && wget http://public-repo-1.hortonworks.com/ARTIFACTS/$JDK_ARTIFACT && \
    tar -xf $JDK_ARTIFACT && rm -f $JDK_ARTIFACT
ENV JAVA_HOME /usr/jdk64/$JDK_VERSION
ENV PATH $JAVA_HOME/bin:$PATH

# jce
ADD http://public-repo-1.hortonworks.com/ARTIFACTS/UnlimitedJCEPolicyJDK7.zip $JAVA_HOME/jre/lib/security/
RUN cd $JAVA_HOME/jre/lib/security && unzip UnlimitedJCEPolicyJDK7.zip && rm -f UnlimitedJCEPolicyJDK7.zip && mv UnlimitedJCEPolicy/*jar . && rm -rf UnlimitedJCEPolicy

Then, after ambari-server starts, but before I register the blueprint or start cluster deployment, I run

docker exec amb-server ambari-server setup -s -j /usr/jdk64/jdk1.8.0_60
docker exec amb-server ambari-server restart

I think it hadn't been working for me before because I had forgotten to run ambari-server restart, or I was running it after the cluster had already been deployed.

I definitely agree about preinstalling into the image to help the startup time. I think I'll open a separate thread about the possibilities of preinstalling or predownloading the contents of the HDP repo, as that would also help significantly.

grozeille commented 7 years ago

I'm not sure that it's needed to choose the JDK, v7 is quite old now, v8 is standard and minimal version for future stack versions. The pull request https://github.com/sequenceiq/docker-ambari/pull/138 will change the jdk to be v8