elasticsearch升级步骤
ES从1.2.1升级到1.4.0
升级步骤,基本上是按照官网的叙述来完成的,链接是:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-upgrade.html#_1_0_and_later,参考的内容如下:
1.0 and lateredit To back up a running 1.0 or later system, it is simplest to use the snapshot feature. Complete instructions for backup and restore with snapshots are available here. rolling upgrade processedit A rolling upgrade allows the ES cluster to be upgraded one node at a time, with no observable downtime for end users. Running multiple versions of Elasticsearch in the same cluster for any length of time beyond that required for an upgrade is not supported, as shard replication from the more recent version to the previous versions will not work. Within minor or maintenance releases after release 1.0, rolling upgrades are supported. To perform a rolling upgrade: Disable shard reallocation (optional). This is done to allow for a faster startup after cluster shutdown. If this step is not performed, the nodes will immediately start trying to replicate shards to each other on startup and will spend a lot of time on wasted I/O. With shard reallocation disabled, the nodes will join the cluster with their indices intact, without attempting to rebalance. After startup is complete, reallocation will be turned back on. This syntax applies to Elasticsearch 1.0 and later: curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "none" } }' Shut down a single node within the cluster. curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown' Confirm that all shards are correctly reallocated to the remaining running nodes. Upgrade the stopped node. To upgrade using a zip or compressed tarball from elasticsearch.org: Extract the zip or tarball to a new directory, usually in the same volume as the current Elasticsearch installation. Do not overwrite the existing installation, as the downloaded archive will contain a default elasticsearch.yml file and will overwrite your existing configuration. Copy the configuration files from the old Elasticsearch installation’s config directory to the new Elasticsearch installation’s config directory. Move data files from the old Elasticsesarch installation’s data directory if necessary. If data files are not located within the tarball’s extraction directory, they will not have to be moved. The simplest solution for moving from one version to another is to have a symbolic link for elasticsearch that points to the currently running version. This link can be easily updated and will provide a stable access point to the most recent version. Update this symbolic link if it is being used. To upgrade using a .deb or .rpm package: Use rpm or dpkg to install the new package. All files should be placed in their proper locations, and config files should not be overwritten. Start the now upgraded node. Confirm that it joins the cluster. Re-enable shard reallocation: curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "all" } }' Observe that all shards are properly allocated on all nodes. Balancing may take some time. Repeat this process for all remaining nodes. It may be possible to perform the upgrade by installing the new software while the service is running. This would reduce downtime by ensuring the service was ready to run on the new version as soon as it is stopped on the node being upgraded. This can be done by installing the new version in its own directory and using the symbolic link method outlined above. It is important to test this procedure first to be sure that site-specific configuration data and production indices will not be overwritten during the upgrade process.
刚开始的时候比较担心数据迁移问题,后来发现可以在配置文件中修改索引数据的路径,或者按照上文提示,直接把配置文件,索引数据文件,插件目录等拷贝过去后,重启当前节点,然后执行下面的命令即可.
curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { "cluster.routing.allocation.enable" : "all" } }'