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

Changing hostname after starting an InfluxDB is problematic #419

Closed
jvshahid opened this issue Apr 8, 2014 · 10 comments
Closed

Changing hostname after starting an InfluxDB is problematic #419

jvshahid opened this issue Apr 8, 2014 · 10 comments
Milestone

Comments

@jvshahid
Copy link
Contributor

jvshahid commented Apr 8, 2014

Changing the hostname throught the os or by setting it in the config file causes the InfluxDB instance to not start and throw a nil pointer dereference. We have two options here:

  1. Automatically/Manually recover from this situtation
  2. Make hostname a required option in the config file and refuse to start if it wasn't set.

These two options require the ability to detect if a hostname changed after influxdb was started and take one of the actions. So first step is to detect when the hostname change.

@jvshahid jvshahid added this to the 0.5.6 milestone Apr 8, 2014
@jvshahid jvshahid self-assigned this Apr 8, 2014
@jvshahid jvshahid modified the milestones: 0.5.7, 0.5.6 Apr 9, 2014
@otoolep
Copy link
Contributor

otoolep commented Apr 15, 2014

I hit this issue -- it's pretty easy to bring out. Surely option #2 isn't really a fix, since someone could always set the hostname explicitly to one value (hostname1), and then just set it to another value (hostname2) next time? Because if I do that, it still happens. :-)

Is option #1 feasible? I see from the logs that there is still reference to the first hostname (hostname1):

[04/14/14 21:16:32] [INFO] ClusterServer: 1 connecting to: hostname1:8099

so I guess it's coming from an older cluster configuration file on disk.

@schmurfy
Copy link
Contributor

I just go bitten by this too, very annoying. Renaming my server should not make anything on it crash :s
I think making the hostname config parameter mandatory is a decent and easy fix, I suppose the "hostname" is just used as an identifier of sort for clustering right ?

@pauldix
Copy link
Member

pauldix commented Apr 17, 2014

it's used as an identifier for clustering, but it needs to be resolvable.
It's used by all the other boxes in the cluster to make a connection to it.

On Thu, Apr 17, 2014 at 6:14 AM, Julien Ammous notifications@github.comwrote:

I just go bitten by this too, very annoying. Renaming my server should not
make anything on it crash :s
I think making the hostname config parameter mandatory is a decent and
easy fix, I suppose the "hostname" is just used as an identifier of sort
for clustering right ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/419#issuecomment-40699941
.

@schmurfy
Copy link
Contributor

ok I see.
Since the server detects it one way or the other (it crashs xD), wouldn't it be possible to use this as a trigger to refresh the hostname and update its internal database/state/whetever to use the new hostname ?

@jvshahid
Copy link
Contributor Author

@schmurfy that's exactly what this issue is about. That is the best solution if it's feasible. I can't think of a reason why we can't do this.

@otoolep
Copy link
Contributor

otoolep commented Apr 17, 2014

What actually appears to be happening -- from looking at the code and the logs -- is that the standalone node thinks it has a another node to connect to -- a node by the name of the previous hostname.

@pauldix pauldix modified the milestones: 0.5.9, 0.5.7, 0.5.10, 0.5.11 Apr 17, 2014
@schmurfy
Copy link
Contributor

is there a workaround in the meantime to allow renaming hosts ?
Currently I need to force the old name in the config but I wish I could get rid of the old name since my config file is generated and I have multiple hosts to manage this means I have to keep the old name around :(

is there a way to manually "fix" the influxdb state to properly teach it its new hostname ?

@jvshahid jvshahid modified the milestones: 0.5.12, 0.5.11 Apr 25, 2014
@pauldix
Copy link
Member

pauldix commented Apr 27, 2014

you may be able to update it in the raft directory. Those files are
basically JSON. If you stop the server, then search and replace in any of
the files in the raft dir, then update the hostname in your config, you
should be good to go. Although, it's a good idea to make a copy of
everything first ;)

On Thu, Apr 24, 2014 at 6:48 AM, Julien Ammous notifications@github.comwrote:

is there a workaround in the meantime to allow renaming hosts ?
Currently I need to force the old name in the config but I wish I could
get rid of the old name since my config file is generated and I have
multiple hosts to manage this means I have to keep the old name around :(

is there a way to manually "fix" the influxdb state to properly teach it
its new hostname ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/419#issuecomment-41266570
.

@pauldix
Copy link
Member

pauldix commented Apr 27, 2014

ok, I actually retract what I just said. Chances are you have a Raft snapshot already and you won't be able to update that manually. We'll try to get to this next week. Thanks

@jvshahid
Copy link
Contributor Author

This fix allows changing hostnames in a single node cluster setup, which seems to be the most common use case. I'll open a new issue to make it possible to change hostnames/ports in a cluster of nodes.

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

4 participants