龙芯 LoongArch64编译es7.17.20

下载es代码

下载好源码后,上传源码到需要编译的服务器

下载gradle版本

打开源码,查看对应es的gradle编译版本

jsx 复制代码
cd ./elasticsearch-7.17.20/gradle/wrapper
vim gradle-wrapper.properties

下面是es7.17.20对应的gradle信息

jsx 复制代码
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

下载gradle

services.gradle.org/distributio...

将下载的gradle包复制到 elasticsearch-7.17.20/gradle/wrapper路径下

修改gradle-wrapper.properties信息,distributionUrl删除前缀,从本地load gradle

jsx 复制代码
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=194717442575a6f96e1c1befa2c30e9a4fc90f701d7aee33eb879b79e7ff05c0
distributionUrl=gradle-8.7-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

修改Architecture.java 文件,添加loongarch64架构支持

文件路径为:/elasticsearch-7.17.20/build-tools/src/main/java/org/elasticsearch/gradle/Architecture.java

jsx 复制代码
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0 and the Server Side Public License, v 1; you may not use this file except
 * in compliance with, at your election, the Elastic License 2.0 or the Server
 * Side Public License, v 1.
 */

package org.elasticsearch.gradle;

public enum Architecture {

    X64("x86_64", "linux/amd64"),
    AARCH64("aarch64", "linux/arm64");
    LOONGARCH64("loongarch64"); // ✅ 新增

    public final String classifier;
    public final String dockerPlatform;

    Architecture(String classifier, String dockerPlatform) {
        this.classifier = classifier;
        this.dockerPlatform = dockerPlatform;
    }

    public static Architecture current() {
        final String architecture = System.getProperty("os.arch", "");
        switch (architecture) {
            case "amd64":
            case "x86_64":
                return X64;
            case "aarch64":
                return AARCH64;
           case "loongarch64":            // ✅ 新增
                return LOONGARCH64;            
            default:
                throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
        }
    }

}

编译es

执行下面的gradle命令,进行es编译

jsx 复制代码
./gradlew :distribution:archives:linux-tar:assemble \
  -x :x-pack:plugin:ml:build \
  -x :x-pack:plugin:ml:bundlePlugin \
  -x :x-pack:plugin:ml:assemble \
  -x :x-pack:plugin:ml:processResources \
  -x :x-pack:plugin:ml:jar \
  -x :x-pack:plugin:ml:zip

构建成功后,包路径为:

jsx 复制代码
distribution/archives/linux-tar/build/distributions/elasticsearch-7.17.20-SNAPSHOT.tar.gz

删除的x-pack-eql模块

路径如下:

jsx 复制代码
elasticsearch-7.17.20-SNAPSHOT/modules/x-pack-eql

禁用ml等模块

修改es的配置config/elasticsearch.yml,添加如下配置:

jsx 复制代码
xpack.security.enabled: false
xpack.ml.enabled: false
xpack.monitoring.enabled: false
xpack.watcher.enabled: false

注意事项

  • 1.本文编译时,使用的jdk版本为openjdk-17构建
相关推荐
烛之武1 小时前
SpringBoot基础
java·spring boot·后端
橙序员小站1 小时前
Harness Engineering:从 OpenClaw 看 AI 助理的基础设施建设
后端·aigc·openai
小陈工2 小时前
2026年3月28日技术资讯洞察:5G-A边缘计算落地、低延迟AI推理革命与工业智造新范式
开发语言·人工智能·后端·python·5g·安全·边缘计算
azhou的代码园2 小时前
基于SpringBoot+微信小程序的图片识别科普系统
spring boot·后端·微信小程序
Tony Bai3 小时前
Rust 看了流泪,AI 看了沉默:扒开 Go 泛型最让你抓狂的“残疾”类型推断
开发语言·人工智能·后端·golang·rust
用户3167361303423 小时前
javaLangchain4j从官方文档入手,看他做了什么——具体使用(二)
后端
無名路人3 小时前
Zsh 脚本 + VS Code 任务:NestJS + Vue3 一键部署到 1Panel
运维·后端·自动化运维
ybwycx4 小时前
springboot之集成Elasticsearch
spring boot·后端·elasticsearch
程途知微4 小时前
AQS 同步器——Java 并发框架的核心底座全解析
java·后端
iPadiPhone5 小时前
分布式架构的“润滑剂”:RabbitMQ 核心原理与大厂面试避坑指南
分布式·后端·面试·架构·rabbitmq