Developing for Splunk Enterprise

How to move splunk from one location to another

shahk
Explorer

Hi ,

I have installed splunk with the rpm package in my system in /opt directory . so now my splunk home directory is /opt/splunk. But because of our company's policy we have to install it in other directory structure for automation purpose.
I tried to copy whole splunk direcotry to another location and started splunk but it is giving warning messages and errors, although i changed splunk home directory location in splunk-launch.conf.

Is there any certain way to migrate splunk when we have installed it with rpm installer as it seems it hradcodes splunk home location in lib and binary files.

Let me know if there is a solution for this.

Regards,
krimesh

Tags (1)
0 Karma

echalex
Builder

Hi,
Do you have a problem with reinstalling splunk? I would very much recommend against moving it after installing with rpm, because rpm may get confused.

If you can reinstall, rpm takes an option, --prefix, which you can use to specify the location of the install directory. I'm not that familiar with rpm, so not sure if you can use the following directly to upgrade/reinstall, but at least it works if you remove splunk first.

rpm -Uvh --prefix=/custom/location /path-to-rpm/splunk-6.6.2-4b804538c686-linux-2.6-x86_64.rpm

Note, that you need to specify the --prefix also when upgrading.

If you can't reinstall, but have to move, then perhaps you can try changing the SPLUNK_HOME in etc/splunk-launch.conf.

SPLUNK_HOME=/custom/location

koshyk
Super Champion

Multiple options
- for automated deployments and using RPM as such use option prefix in : rpm --prefix=/target/directory <splunk-installable>.rpm . You can even write wrapper scripts to do make it handsfree including adding to init.d . Sample here
- For one-off or non-rpm approach is to untar the .tgz Splunk installable into relevant directory. tar -xzf <splunk-installable>.tgz -C /target/directory
- If you want to migrate, it depends on your environment (eg clustering). For standalone, just copy all the contents of $SPLUNK_HOME/etc/* from old to new installation afterwards.

0 Karma

skalliger
SplunkTrust
SplunkTrust

Hi,

  1. Get a tar.gz package and install it where you want (meaning, backup the directory, re-install, place your configs there again).
  2. Post your error(s) please.

Skalli

0 Karma

shahk
Explorer

Do you mean to install splunk by tar.gz , ot shoud back up of exisiting splunk direcotry and copy to required location and untar it?

Regards,
Krimesh

0 Karma

skalliger
SplunkTrust
SplunkTrust

Back up, fresh install by tar.gz and then try to copy the configs.

I was greping through my configs and didn't find any "/opt/splunk" lines.

Skalli

0 Karma

JDukeSplunk
Builder

I think you can basically take the whole /opt/splunk/etc/* folder from the old box and plop it down on the new one provided they are the same versions. That said, you will need to replace the host name in a few places. grep for your hostname

0 Karma