Road ES source of (a): start locally compiled source code

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_36421826/article/details/102776408

Road ES source of (a): start locally compiled source code

First come some courtesy, tell us about ES:

ElasticSearch is based on Lucene search server. It provides a distributed multi-user capabilities of full-text search engine, based on RESTful web interface. Elasticsearch is a Java language development, and as open source under the Apache license terms published, is a popular enterprise-class search engine. ElasticSearch for cloud computing , it is possible to achieve real-time search, stable, reliable, fast and easy to install. The official client in Java, .NET (C #), PHP, Python, Apache Groovy, Ruby and many other languages are available. According to DB-Engines rankings show, Elasticsearch enterprise search engine is the most popular, followed by Apache Solr, also based on Lucene.

Now began to introduce local ES source code is compiled and started for the back of the source code analysis to prepare:

First, download the ES, the choice of this version elasticsearch6.1.2

Compile ES needs gradle, 6.1.2 version of the ES needs gradle 3.3 above is not too high as 5.6

gradle not specifically indicated, found about a lot.

/. Gradle / ini.gradle added Ali cloud warehouse in% user%

allprojects{
    repositories {
        def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
                    remove repo
                }
            }
        }
        maven {
            url REPOSITORY_URL
        }
    }
}

Elasticsearch6.1.2 downloaded into the directory, gradle elasticsearch, start downloading something

 Task :buildSrc:compileGroovy FAILED

If it fails try several times to ok

Two, gradle related issues

build.gradle, right into the IDEA buildSrc import gradle project directory, and if an error

A problem occurred evaluating project ':benchmarks'.
> Failed to apply plugin [id 'elasticsearch.build']
   > JAVA_HOME must be set to build Elasticsearch

Into elasticsearch-6.1.2 \ buildSrc \ src \ main \ groovy \ org \ elasticsearch \ gradle \ BuildPlugin.groovy directory

173 lines of code

String javaHome = System.getenv('JAVA_HOME')

Into a directory of your settings

String javaHome = "D:\\soft\\Java\\jdk1.8.0_202";

Error try again

A problem occurred evaluating project ':benchmarks'.
> Failed to apply plugin [id 'elasticsearch.build']
   > Gradle 4.3 or above is required to build elasticsearch

Download gradle4.4 resume

The maven url build.gradle in the distribution directory into Ali cloud

buildscript {
  repositories {
    maven {
      url "http://maven.aliyun.com/nexus/content/groups/public/"
    }
  }
  dependencies {
    classpath 'com.netflix.nebula:gradle-ospackage-plugin:3.4.0'
  }
}

Compile, execute ./gradlew assemble at ES directory

es compiler

Compile success
Compile success

\ Distribution \ zip \ \ directory under distributions elasticsearch-6.1.2 build is compiled project

Third, run

ES running locally need to specify the source of the main class

for

org.elasticsearch.bootstrap.Elasticsearch

Run error

path.home is not configured
vm option添加
-Des.path.home=D:\workspace\elasticsearch-6.1.2\distribution\zip\build\distributions\elasticsearch-6.1.2 -Des.path.conf=D:\workspace\elasticsearch-6.1.2\distribution\zip\build\distributions\elasticsearch-6.1.2\config 

Continue running error:

Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "registe
添加  
-Dlog4j2.disable.jmx=true

Run, show starts successfully:

Insufficient disk space available, es will be given

[2019-10-28T10:44:25,144][WARN ][o.e.c.r.a.DiskThresholdMonitor] [gX-XS76] high disk watermark [90%] exceeded on [gX-XS76eQ_qEWQUFNZKFLA][gX-XS76][D:\workspace\elasticsearch-6.1.2\distribution\zip\build\distributions\elasticsearch-6.1.2\data\nodes\0] free: 8.3gb[6%], shards will be relocated away from this node
[2019-10-28T10:44:25,144][INFO ][o.e.c.r.a.DiskThresholdMonitor] [gX-XS76] rerouting shards: [high disk watermark exceeded on one or more nodes]
[2019-10-28T10:44:55,149][WARN ][o.e.c.r.a.DiskThresholdMonitor] [gX-XS76] high disk watermark [90%] exceeded on [gX-XS76eQ_qEWQUFNZKFLA][gX-XS76][D:\workspace\elasticsearch-6.1.2\distribution\zip\build\distributions\elasticsearch-6.1.2\data\nodes\0] free: 8.3gb[6%], shards will be relocated away from this node
[2019-10-28T10:45:25,151][WARN ][o.e.c.r.a.DiskThresholdMonitor] [gX-XS76] high disk watermark [90%] exceeded on [gX-XS76eQ_qEWQUFNZKFLA][gX-XS76][D:\workspace\elasticsearch-6.1.2\distribution\zip\build\distributions\elasticsearch-6.1.2\data\nodes\0] free: 8.3gb[6%], shards will be relocated away from this node
[2019-10-28T10:45:25,151][INFO ][o.e.c.r.a.DiskThresholdMonitor] [gX-XS76] rerouting shards: [high disk watermark exceeded on one or more nodes]
......

The first phase is completed

Guess you like

Origin blog.csdn.net/qq_36421826/article/details/102776408