我正在尝试在docker容器中运行kairodDB,这是我的dockerfile
FROM centos:latest
MAINTAINER http://www.centos.org
LABEL Vendor="CentOS"
RUN mkdir /usr/java
RUN yum -y install wget
RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz -O /usr/java/jdk-8u51-linux-x64.tar.gz
RUN tar -zxvf /usr/java/jdk-8u51-linux-x64.tar.gz -c /usr/java/jdk-8u51-linux-x64
RUN alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_51/bin/java 1
RUN wget --no-check-certificate https://github.com/kairosdb/kairosdb/releases/download/v1.1.3/kairosdb-1.1.3-1.rpm
RUN yum -y install kairosdb-1.1.3-1.rpm
ENV JAVA_HOME=/usr/java/jdk1.8.0_51
# Comment out H2 Module set for kairosdb.datastore
RUN sed -i '/H2Module/s/^/#/' /opt/kairosdb/conf/kairosdb.properties
# Uncomment Cassandra Module for kairosdb.datastore
RUN sed -i '/org.kairosdb.datastore.cassandra.CassandraModule/s/^#//g' /opt/kairosdb/conf/kairosdb.properties
# Add Roundrobin connection to cassandra host
RUN sed -i '/^#kairosdb.datastore.cassandra.hector.loadBalancingPolicy*/c\kairosdb.datastore.cassandra.hector.loadBalancingPolicy=roundRobin' /opt/kairosdb/conf/kairosdb.properties
# Add startup script
ADD start-kairosdb.sh /opt/kairosdb/bin/start-kairosdb.sh
# Run kairosdb in foreground on boot
ENTRYPOINT ["/bin/bash", "/opt/kairosdb/bin/start-kairosdb.sh"]
包含start-kairosdb.sh
#!/bin/bash
<some config changes>
/opt/kairosdb/bin/kairosdb.sh run
但是,当我使用docker run -d kairosdb
启动容器时,它不会作为服务运行,容器会立即存在。
任何人都知道这里有什么不对吗?
答案 0 :(得分:1)
您JAVA_HOME
不正确。应该
ENV JAVA_HOME=/usr/java/jdk-8u51-linux-x64/jdk1.8.0_51
即使你纠正了它,它也会因错误而失败,因为它无法找到cassandra主机。
10:02:27.642 [main] INFO [TelnetServerModule.java:38] - Configuring module TelnetServerModule
10:02:28.153 [main] INFO [StdSchedulerFactory.java:1175] - Using default implementation for ThreadExecutor
10:02:28.170 [main] INFO [SchedulerSignalerImpl.java:61] - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
10:02:28.171 [main] INFO [QuartzScheduler.java:243] - Quartz Scheduler v.2.1.7 created.
10:02:28.172 [main] INFO [RAMJobStore.java:154] - RAMJobStore initialized.
10:02:28.173 [main] INFO [QuartzScheduler.java:268] - Scheduler meta-data: Quartz Scheduler (v2.1.7) 'QuartzScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 4 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
10:02:28.173 [main] INFO [StdSchedulerFactory.java:1324] - Quartz scheduler 'QuartzScheduler' initialized from an externally provided properties instance.
10:02:28.173 [main] INFO [StdSchedulerFactory.java:1328] - Quartz scheduler version: 2.1.7
10:02:28.174 [main] INFO [QuartzScheduler.java:2247] - JobFactory set to: org.kairosdb.core.scheduler.KairosDBJobFactory@740cae06
10:02:28.174 [main] INFO [Main.java:484] - Starting service class org.kairosdb.core.scheduler.KairosDBSchedulerImpl
10:02:28.174 [main] INFO [QuartzScheduler.java:534] - Scheduler QuartzScheduler_$_NON_CLUSTERED started.
10:02:28.197 [main] INFO [CassandraHostRetryService.java:48] - Downed Host Retry service started with queue size -1 and retry delay 10s
10:02:28.246 [main] INFO [JmxMonitor.java:52] - Registering JMX me.prettyprint.cassandra.service_kairosdb-cluster:ServiceType=hector,MonitorType=hector
10:02:28.261 [main] ERROR [HConnectionManager.java:71] - Could not start connection pool for host localhost(127.0.0.1):9160
10:02:28.262 [main] INFO [CassandraHostRetryService.java:68] - Host detected as down was added to retry queue: localhost(127.0.0.1):9160
10:02:28.263 [Hector.me.prettyprint.cassandra.connection.CassandraHostRetryService-1] WARN [CassandraHostRetryService.java:217] - Downed localhost(127.0.0.1):9160 host still appears to be down: Unable to open transport to localhost(127.0.0.1):9160 , java.net.ConnectException: Connection refused
10:02:28.274 [main] ERROR [Main.java:351] - Failed starting up services
com.google.inject.ProvisionException: Guice provision errors:
1) Error injecting constructor, org.kairosdb.core.exception.DatastoreException: me.prettyprint.hector.api.exceptions.HectorException: All host pools marked down. Retry burden pushed out to client.
at org.kairosdb.datastore.cassandra.CassandraDatastore.<init>(CassandraDatastore.java:113)
at org.kairosdb.datastore.cassandra.CassandraModule.configure(CassandraModule.java:66)
while locating org.kairosdb.datastore.cassandra.CassandraDatastore
at org.kairosdb.datastore.cassandra.CassandraModule.configure(CassandraModule.java:65)
while locating org.kairosdb.core.datastore.Datastore
for parameter 0 at org.kairosdb.core.datastore.KairosDatastore.<init>(KairosDatastore.java:72)
at org.kairosdb.core.CoreModule.configure(CoreModule.java:76)
while locating org.kairosdb.core.datastore.KairosDatastore
for parameter 1 at org.kairosdb.core.jobs.CacheFileCleaner.<init>(CacheFileCleaner.java:41)
at org.kairosdb.core.CoreModule.configure(CoreModule.java:81)
while locating org.kairosdb.core.jobs.CacheFileCleaner
1 error
at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)
at org.kairosdb.core.scheduler.KairosDBSchedulerImpl.start(KairosDBSchedulerImpl.java:68)
at org.kairosdb.core.Main.startServices(Main.java:485)
at org.kairosdb.core.Main.main(Main.java:340)