Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deb package init script issue #239

Closed
theslavek opened this issue Nov 14, 2015 · 17 comments
Closed

Deb package init script issue #239

theslavek opened this issue Nov 14, 2015 · 17 comments
Milestone

Comments

@theslavek
Copy link

Hi, once successfully installed KairosDB from the last DEB package on Ubuntu 14.04, after issuing the command for starting the service sudo service kairosdb start it replies with /etc/init.d/kairosdb: line 52: syntax error: unexpected end of file. Has anyone experienced the same behaviour? Thanks in advance!

@at15
Copy link
Contributor

at15 commented Nov 14, 2015

see #234

@theslavek
Copy link
Author

Hey, thank you. I have edited the /etc/init.d/kairosdb file for [ -f /etc/init.d/functions ] && . /etc/init.d/functions according to #236. But even though I've done that, init.d script behaves weird. For sudo service kairosdb start it starts, for stop it stops, that's ok. But for status it says status: Unknown job: kairosdb. And it also doesn't start automatically after boot. I wish it would have been starting automatically, any chance I can achieve that? Thank you in advance for help. I want to use KairosDB for my final thesis and wish it will be working like this.

@at15
Copy link
Contributor

at15 commented Nov 18, 2015

re @slavomirdittrich

1. why the status command got unknown job

Because status command is for upstart jobs not scripts in init.d, see this question
when you try to get status using command service kairosdb status see https://github.com/kairosdb/kairosdb/blob/develop/src/scripts/kairosdb-service.sh#L43 it call status kairosdb, so you got the error

2. implement your own status command

have a look at other common service that have status command, like mysql and nginx
for nginx, see /etc/init.d/nginx, it just check if the process with the pid stored in pid file is still running

status)
        status_of_proc -p $PID "$DAEMON" "$NAME" && exit 0 || exit $?

for mysql, it ping mysql server.
for me, the best way is to check the web ui for kairosdb, but it may not be a good idea if you don't want to expose the web ui when deploy kairosdb in public cloud.

3. how to start it automatically after boot

you need to config manually, kairosdb-service.sh does not config auto start, it just make kairosdb run in background, store the pid and redirect the log

@theslavek
Copy link
Author

Thank you very much. This helps.
Anyway, even though I put manual config of kairosdb service using update-rc.d, it just won't start automatically. I thought it could have been because of cassandra hasn't started before so I also used priorities of cassandra start 10 stop 90 and kairosdb start 90 stop 10, but no success...

@paladini
Copy link
Member

@slavekdittrich I'm having the same issue here.

Can you post your log files here? Restart your server/computer that runs KairosDB at startup and copy the log here. The log file for the current day is (usually) located at /opt/kairosdb/log/kairosdb.log.

Following you can check my log: https://gist.github.com/paladini/7f7f07fe43c11c64b4f4

I can start KairosDB with sudo service kairosdb start correctly at any time, but I can't start it correctly at boot time.


I've made the following to try boot up my Xubuntu with Cassandra + KairosDB:

Changed /etc/init.d/kairosdb to make my script wait 5 seconds before start (another approach to make KairosDB start only after Cassandra):

(...)
### main logic ###
case "$1" in
  start)
    sleep 10
        start
        ;;
(...)

Now on my Terminal:

# Removing KairosDB and Cassandra from startup
$ sudo update-rc.d -f kairosdb remove
$ sudo update-rc.d -f cassandra remove

# Enabling Cassandra to start on instant 01 and KairosDB to start on instant 99.
$ sudo update-rc.d cassandra defaults 01 99
$ sudo update-rc.d kairosdb defaults 99 01

I have no success with that. Still getting the same error at startup :/ @at15 Any tips?

@theslavek
Copy link
Author

@paladini I'm glad I'm not the only trying to solve this exact issue.

You can find my log here: https://gist.github.com/slavekdittrich/16f77c83a8ba5c2e60e8

I did try the same approach with different start and stops of cassandra and kairosdb services using update-rc.d, but it doesn't solve the problem either.

I have also tried using my own upstart script in /etc/init/kairosdb.conf where I tried to sleep a couple of seconds before calling command sudo service kairosdb start (which works when executed manually after cassandra is running) to make sure that cassandra is up and running, but no success.

@paladini
Copy link
Member

@slavekdittrich Let me know if you find an answer to solve this problem. If I find a fix to the problem I'll do the same.

About the sudo service kairosdb status: I've made a PR ( #242 ) to fix this issue. If you don't want to wait until a new version of KairosDB is released, take a look at the modified file on my PR: https://github.com/paladini/kairosdb/blob/7ebe979aad18ccb9540287a05b25e038c53ac721/src/scripts/kairosdb-service.sh

@paladini
Copy link
Member

paladini commented Dec 3, 2015

Hi @slavekdittrich , any news on that?

I don't have any progress here. What about you?

@paladini
Copy link
Member

paladini commented Dec 7, 2015

@slavekdittrich I've some success here, do you still need help? It's only a temporary solution, but I'm looking for a more robust solution.

If you still need help, tell me.

@theslavek
Copy link
Author

Yes I do and would highly appreciate your help.
On Dec 7, 2015 9:56 PM, "Fernando Paladini" notifications@github.com
wrote:

@slavekdittrich https://github.com/slavekdittrich I've some success
here, do you still need help? It's only a temporary solution, but I'm
looking for a more robust solution
http://stackoverflow.com/questions/34141827/loop-while-program-give-incorrect-output-in-shell-script?noredirect=1#comment56032136_34141827
.

If you still need help, tell me.


Reply to this email directly or view it on GitHub
#239 (comment).

@paladini
Copy link
Member

paladini commented Dec 7, 2015

Well, remember that we've tested the /etc/init.d/kairosdb with a sleep and it didn't work? Well, I increased a lot the sleep time and now it's working. As I said, it's just a workaround, I'm still looking for a more robust solution.

My /etc/init.d/kairosdb is seems like that right now: https://gist.github.com/paladini/e89d6f844f698ec61330

If you still can't boot up KairosDB after Cassandra tell me so I'll try to guide you. If you need any other information let me know.

@brianhks
Copy link
Member

brianhks commented Dec 8, 2015

This was a bit of a design issue. If you have Kiaros miss configured it shouldn't start up. I'll look into a configuration option that lets Kairos startup even if it cannot immediately talk to Cassandra. Long term I think this is the better solution.

@paladini
Copy link
Member

paladini commented Dec 8, 2015

@brianhks I think that isn't a miss configuration, the problem is within the Cassandra dependency. In our case KairosDB is starting with the system, the problem is that KairosDB starts without waiting for Cassandra (then KairosDB is closed by an error).

@theslavek
Copy link
Author

@paladini Thank you very much for the script! This solution starts KairosDB after startup indeed. As @brianhks suggests if it's a missconfiguration, which I also think it's not this case, can you gist your kairosdb.properties file? For compare, here is mine: https://gist.github.com/slavekdittrich/eac01cdd29db9ce3f77c. It's just a basic configuration.

@hostops
Copy link

hostops commented Sep 6, 2018

Still opened?
Is this project dead? Because to fix issue that is simple as that should not last 3 years.

@brianhks brianhks added this to the v1.3.0 milestone Jan 2, 2019
@brianhks
Copy link
Member

brianhks commented Jan 2, 2019

Adding a sleep to the startup is a hack. I left this ticket open so to remember to add functionality to kairos to startup without a connection to Cassandra. As a partial work around the startup script was changed to systemd which allows adding dependencies on other services.

I'm going to leave this open until an option is added to startup without C* available.

brianhks added a commit that referenced this issue Feb 8, 2019
…llow kairos to startup without Cassandra being up #239 #307
@brianhks
Copy link
Member

brianhks commented Feb 8, 2019

Kairos can start without C* being up :)

@brianhks brianhks closed this as completed Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants