Commit 130dfd7c authored by Achilleas Pipinellis's avatar Achilleas Pipinellis

Add steps in recommendation section

parent 35fcdc9f
...@@ -103,37 +103,38 @@ As a last step, move on to ...@@ -103,37 +103,38 @@ As a last step, move on to
After [enabling Elasticsearch](#enable-elasticsearch), you must run the After [enabling Elasticsearch](#enable-elasticsearch), you must run the
following rake tasks to add GitLab's data to the Elasticsearch index. following rake tasks to add GitLab's data to the Elasticsearch index.
It might take a while depending on how big your Git repositories are. It might take a while depending on how big your Git repositories are (see
[Indexing large repositories](#indexing-large-repositories)).
--- ---
To index all your repositories: To index all your repositories:
``` ```
# omnibus installations # Omnibus installations
sudo gitlab-rake gitlab:elastic:index_repositories sudo gitlab-rake gitlab:elastic:index_repositories
# installations from source # Installations from source
bundle exec rake gitlab:elastic:index_repositories RAILS_ENV=production bundle exec rake gitlab:elastic:index_repositories RAILS_ENV=production
``` ```
To index all wikis: To index all wikis:
``` ```
# omnibus installations # Omnibus installations
sudo gitlab-rake gitlab:elastic:index_wikis sudo gitlab-rake gitlab:elastic:index_wikis
# installations from source # Installations from source
bundle exec rake gitlab:elastic:index_wikis RAILS_ENV=production bundle exec rake gitlab:elastic:index_wikis RAILS_ENV=production
``` ```
To index all database entities: To index all database entities:
``` ```
# omnibus installations # Omnibus installations
sudo gitlab-rake gitlab:elastic:index_database sudo gitlab-rake gitlab:elastic:index_database
# installations from source # Installations from source
bundle exec rake gitlab:elastic:index_database RAILS_ENV=production bundle exec rake gitlab:elastic:index_database RAILS_ENV=production
``` ```
...@@ -146,48 +147,58 @@ for the changes to take effect. ...@@ -146,48 +147,58 @@ for the changes to take effect.
## Special recommendations ## Special recommendations
### Indexing huge repositories Here are some tips to use Elasticsearch with GitLab more efficiently.
Indexing huge git repositories can take a while, to speed up a process you can disable an auto refreshing. In our experience you can expect 20% time drop.
``` ### Indexing large repositories
# Disable refreshing
curl -XPUT localhost:9200/_settings -d '{
"index" : {
"refresh_interval" : "-1"
} }'
# Enable refreshing again(after indexing) Indexing large Git repositories can take a while. To speed up the process, you
curl -XPUT localhost:9200/_settings -d '{ can temporarily disable auto-refreshing. In our experience you can expect a 20%
"index" : { time drop.
"refresh_interval" : "1s"
} }'
1. Disable refreshing:
# A force merge should be called after enabling the refreshing above ```bash
curl -XPOST 'http://localhost:9200/_forcemerge?max_num_segments=5' curl -XPUT localhost:9200/_settings -d '{
``` "index" : {
"refresh_interval" : "-1"
} }'
```
Also you may want to disable replication and eneble it after indexing 1. (optional) You may want to disable replication and enable it after indexing:
``` ```bash
# Desable replication curl -XPUT localhost:9200/_settings -d '{
curl -XPUT 'localhost:9200/_settings' -d ' "index" : {
{ "number_of_replicas" : 0
"index" : { } }'
"number_of_replicas" : 0 ```
}
}' 1. [Create the indexes](#add-gitlabs-data-to-the-elasticsearch-index)
# Enable replication and set to default value, which is 1 1. (optional) If you disabled replication in step 2, enable it after
curl -XPUT 'localhost:9200/_settings' -d ' the indexing is done and set it to its default value, which is 1:
{
"index" : { ```bash
"number_of_replicas" : 1 curl -XPUT localhost:9200/_settings -d '{
} "index" : {
}' "number_of_replicas" : 1
``` } }'
```
1. Enable refreshing again (after indexing):
```bash
curl -XPUT localhost:9200/_settings -d '{
"index" : {
"refresh_interval" : "1s"
} }'
```
1. A force merge should be called after enabling the refreshing above:
```bash
curl -XPOST 'http://localhost:9200/_forcemerge?max_num_segments=5'
```
[ee-109]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/109 "Elasticsearch Merge Request" [ee-109]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/109 "Elasticsearch Merge Request"
[elasticsearch]: https://www.elastic.co/products/elasticsearch "Elasticsearch website" [elasticsearch]: https://www.elastic.co/products/elasticsearch "Elasticsearch website"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment