你可以的,加油
国产替代

国产替代

让 Easysearch 运行在 LoongArch(3C5000L) 上

EasysearchHardy 发表了文章 • 3 个评论 • 1759 次浏览 • 2023-09-11 12:53 • 来自相关话题

简介

在上一次,我介绍了在国产操作系统 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen,小伙伴们可查看原文。今天我重点介绍下在 Loongnix-Server Linux release 8.4.1 (3C5000L)上安装 Easysearch。

系统配置

在安装之前,需要先进行系统参数调整并创建操作用户,以下命令均需要使用 root 用户操作。

#配置nofile和memlock
tee /etc/security/limits.d/21-infini.conf <<-'EOF'
*                soft    nofile         1048576
*                hard    nofile         1048576
*                soft    memlock        unlimited
*                hard    memlock        unlimited
root             soft    nofile         1048576
root             hard    nofile         1048576
root             soft    memlock        unlimited
root             hard    memlock        unlimited
EOF

#关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
grep -i HugePages_Total /proc/meminfo

grep -wq transparent_hugepage /etc/rc.local || cat <<-'EOF' >> /etc/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod 755 /etc/rc.local

#内核调优
tee /etc/sysctl.d/70-infini.conf <<-'EOF'
vm.max_map_count = 262145
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.ip_local_port_range = 1024 65535
EOF
sysctl -p /etc/sysctl.d/70-infini.conf

用户配置

#创建Easysearch操作用户
groupadd -g 602 es
useradd -u 602 -g es -m -d /home/es -c 'easysearch' -s /bin/bash es

配置 JDK

#在各个节点上分别操作
wget -N http://ftp.loongnix.cn/Java/openjdk17/loongson17.4.0-fx-jdk17.0.6_10-linux-loongarch64.tar.gz -P /usr/src

mkdir -p /usr/local/jdk
tar -zxf /usr/src/loongson*.tar.gz -C /usr/local/jdk --strip-components 1

tee /etc/profile.d/java.sh <<-'EOF'
# set java environment
JAVA_HOME=/usr/local/jdk
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
EOF
source /etc/profile
java -version

Easysearch 部署

部署及密码配置

#在线安装
curl -sSL http://get.infini.sh | bash -s -- -p easysearch -d /data/easysearch
#初始化证书(若不采用默认证书,如需要调整证书可修改证书生成文件)
cd /data/easysearch
#默认会生成随机密码
bin/initialize.sh
ll /data/easysearch/config/{*.crt,*.key,*.pem}

配置文件及 JVM 调整

cat <<EOF > /data/easysearch/config/easysearch.yml
cluster.name: infinilabs
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

cluster.initial_master_nodes: ["node-1"]

path.home: /data/easysearch
path.data: /data/easysearch/data
path.logs: /data/easysearch/logs

http.compression: true

security.enabled: true
security.audit.type: noop
security.ssl.transport.cert_file: instance.crt
security.ssl.transport.key_file: instance.key
security.ssl.transport.ca_file: ca.crt
security.ssl.transport.skip_domain_verify: true
security.ssl.http.enabled: true
security.ssl.http.cert_file: instance.crt
security.ssl.http.key_file: instance.key
security.ssl.http.ca_file: ca.crt

security.allow_default_init_securityindex: true

security.nodes_dn:
  - 'CN=infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'

security.restapi.roles_enabled: [ "superuser", "security_rest_api_access" ]

security.system_indices.enabled: true
security.ssl.http.clientauth_mode: OPTIONAL
security.system_indices.indices: [".infini-*"]

#for admin dn
## specify admin certs to operate against system indices, basic_auth is not required
##  curl -k  --cert config/admin.crt --key config/admin.key   -XDELETE 'https://localhost:9200/.infini-*/'
security.authcz.admin_dn:
  - 'CN=admin.infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'
EOF

#根据实际机器内存的大小进行配置,推荐配置为机器内存一半,且不超过31G
sed -i "s/1g/4g/g" $ES_HOME/config/jvm.options

备份目录及权限调整

#创建备份目录
mkdir -p /data/easysearch/backup
#更新目录权限
chown -R es.es /data/easysearch

环境变量及启动服务

su - es
grep -wq easysearch ~/.bashrc || cat<<EOF >> ~/.bashrc
export ES_HOME=/data/easysearch
EOF
source ~/.bashrc

#jna替换<龙芯平台有独立的jna实现>
rm -rvf $ES_HOME/lib/jna*.jar
wget -N https://release.infinilabs.com/easysearch/archive/jna/loongarch64/jna-5.12.1.jar -P $ES_HOME/lib

#以后台方式启动服务
$ES_HOME/bin/easysearch -d

Easysearch 验证

curl -ku "admin:$pass" https://127.0.0.1:9200
curl -ku "admin:$pass" https://127.0.0.1:9200/_cluster/health?pretty
curl -ku "admin:$pass" https://127.0.0.1:9200/_cat/nodes?v

Easysearch信息

部署 Console

curl -sSL http://get.infini.sh | bash -s -- -p console

#安装服务并启动
cd /opt/console
./console-linux-loong64 -service install
./console-linux-loong64 -service start

#验证
systemctl status console

部署 Agent

curl -sSL http://get.infini.sh | bash -s -- -p agent

#修改Agent配置文件
cd /opt/agent
sed -i "/ES_ENDPOINT:/ s|\(.*\: \).*|\1$https://localhost:9200|" agent.yml
sed -i "/ES_USER:/ s|\(.*\: \).*|\1admin|" agent.yml
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
sed -i "/API_BINDING:/ s|\(.*\: \).*|\1\"0.0.0.0:8080\"|" agent.yml
head -n 5 agent.yml

#安装服务并启动
./agent-linux-loong64 -service install
./agent-linux-loong64 -service start

#验证
systemctl status agent

部署 Gateway

curl -sSL http://get.infini.sh | bash -s -- -p gateway
cd /opt/gateway

#修改Gateway配置文件
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
head -n 10 gateway.yml

#安装服务并启动
./gateway-linux-loong64 -service install
./gateway-linux-loong64 -service start

#检查服务
systemctl status gateway
curl -u "admin:$pass" http://127.0.0.1:8000

部署 Loadgen

curl -sSL http://get.infini.sh | bash -s -- -p loadgen

#写入数据测试
cd /opt/loadgen
mkdir -p mock
cat <<EOF > mock/nginx.log
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET / HTTP/1.1" 200 8676 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 17235 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/daterangepicker/daterangepicker.css HTTP/1.1" 200 1700 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/v5-compat.css HTTP/1.1" 200 2091 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/font/raleway.css HTTP/1.1" 200 145 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/fork-awesome.css HTTP/1.1" 200 8401 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/overrides.css HTTP/1.1" 200 2524 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/theme.css HTTP/1.1" 200 306 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fancytree/css/ui.fancytree.css HTTP/1.1" 200 3456 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /syncthing/development/logbar.js HTTP/1.1" 200 486 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
EOF

cat <<EOF > loadgen.yml
env:
  ES_USERNAME: admin
  ES_PASSWORD: $pass
  ES_ENDPOINT: http://localhost:8000
runner:
  # total_rounds: 1
  no_warm: false
  # Whether to log all requests
  log_requests: false
  # Whether to log all requests with the specified response status
  log_status_codes:
    - 0
    - 500
  assert_invalid: false
  assert_error: false
variables:
  - name: ip
    type: file
    path: dict/ip.txt
  - name: message
    type: file
    path: mock/nginx.log
    replace: # replace special characters in the value
      '"': '\"'
      '\': '\\'
  - name: user
    type: file
    path: dict/user.txt
  - name: id
    type: sequence
  - name: uuid
    type: uuid
  - name: now_local
    type: now_local
  - name: now_utc
    type: now_utc
  - name: now_unix
    type: now_unix
  - name: suffix
    type: range
    from: 10
    to: 13
requests:
  - request:
      method: POST
      runtime_variables:
        batch_no: uuid
      runtime_body_line_variables:
        routing_no: uuid
      basic_auth:
        username: $[[env.ES_USERNAME]]
        password: $[[env.ES_PASSWORD]]
      url: $[[env.ES_ENDPOINT]]/_bulk
      body_repeat_times: 5000
      body: |
        { "index" : { "_index" : "test-$[[suffix]]", "_id" : "$[[uuid]]" } }
        { "id" : "$[[uuid]]","routing_no" : "$[[routing_no]]","batch_number" : "$[[batch_no]]","message" : "$[[message]]","random_no" : "$[[suffix]]","ip" : "$[[ip]]","now_local" : "$[[now_local]]","now_unix" : "$[[now_unix]]" }
EOF

#执行测试
./loadgen-linux-loong64 -c 6 -d 6 --compress

#检查测试索引文档
curl -u "admin:$pass" http://127.0.0.1:8000/_cat/indices/test*?v

至此,完成在 LoongArch(3C5000L)上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen。通过浏览器 http://机器域名:9000/ 即可访问 Console,对 Easysearch 进行配置管理。

可能遇到的问题

连接被拒绝

检查下配置文件中监听的地址是否正确,防火墙是否有关闭。

防火墙状态

关于 Easysearch

about easysearch

INFINI Easysearch 是一个分布式的近实时搜索与分析引擎,核心引擎基于开源的 Apache Lucene。Easysearch 的目标是提供一个轻量级的 Elasticsearch 可替代版本,并继续完善和支持更多的企业级功能。 与 Elasticsearch 相比,Easysearch 更关注在搜索业务场景的优化和继续保持其产品的简洁与易用性。

官网文档:https://www.infinilabs.com/docs/latest/easysearch

下载地址:https://www.infinilabs.com/download

让 Easysearch 运行在 Kylin V10 (Lance)-aarch64 上

EasysearchHardy 发表了文章 • 0 个评论 • 3138 次浏览 • 2023-06-07 11:08 • 来自相关话题

简介

本文主要介绍在国产操作系统 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen

系统配置

在安装之前,需要先进行系统参数调整并创建操作用户,以下命令均需要使用 root 用户操作。

#配置nofile和memlock
tee /etc/security/limits.d/21-infini.conf <<-'EOF'
*                soft    nofile         1048576
*                hard    nofile         1048576
*                soft    memlock        unlimited
*                hard    memlock        unlimited
root             soft    nofile         1048576
root             hard    nofile         1048576
root             soft    memlock        unlimited
root             hard    memlock        unlimited
EOF

#关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
grep -i HugePages_Total /proc/meminfo

grep -wq transparent_hugepage /etc/rc.local || cat <<-'EOF' >> /etc/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod 755 /etc/rc.local

#内核调优
tee /etc/sysctl.d/70-infini.conf <<-'EOF'
vm.max_map_count = 262145
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.ip_local_port_range = 1024 65535
EOF
sysctl -p /etc/sysctl.d/70-infini.conf

用户配置

#创建Easysearch操作用户
groupadd -g 602 es
useradd -u 602 -g es -m -d /home/es -c 'easysearch' -s /bin/bash es

配置 JDK

#在各个节点上分别操作
wget -N https://release.infinilabs.com/easysearch/jdk/zulu17.40.19-ca-jdk17.0.6-linux_aarch64.tar.gz -P /usr/src

mkdir -p /usr/local/jdk
tar -zxf /usr/src/zulu*.tar.gz -C /usr/local/jdk --strip-components 1

tee /etc/profile.d/java.sh <<-'EOF'
# set java environment
JAVA_HOME=/usr/local/jdk
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
EOF
source /etc/profile
java -version

Easysearch 部署

部署及密码配置

#在线安装
curl -sSL http://get.infini.sh | bash -s -- -p easysearch -d /data/easysearch
#初始化证书(若不采用默认证书,如需要调整证书可修改证书生成文件)
cd /data/easysearch
bin/initialize.sh
ll /data/easysearch/config/{*.crt,*.key,*.pem}

#调整默认密码及服务配置文件
export ES_HOME=/data/easysearch
pass=`tr -cd 'a-zA-Z0-9!@#$%' </dev/urandom | head -c20`
#记录密码后,删除该文件
echo $pass > /tmp/pass
hash=`$ES_HOME/bin/hash_password.sh -p $pass`
echo $hash

#更新密码字段
cat <<EOF > $ES_HOME/config/security/user.yml
meta:
  type: "user"
  config_version: 2

# Define your internal users here

## Admin users
admin:
  hash: "$hash"
  reserved: true
  external_roles:
    - "admin"
  description: "Admin user"
EOF

配置文件及 JVM 调整

cat <<EOF > /data/easysearch/config/easysearch.yml
cluster.name: infinilabs
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

cluster.initial_master_nodes: ["node-1"]

path.home: /data/easysearch
path.data: /data/easysearch/data
path.logs: /data/easysearch/logs

http.compression: true

security.enabled: true
security.audit.type: noop
security.ssl.transport.cert_file: instance.crt
security.ssl.transport.key_file: instance.key
security.ssl.transport.ca_file: ca.crt
security.ssl.transport.skip_domain_verify: true
security.ssl.http.enabled: true
security.ssl.http.cert_file: instance.crt
security.ssl.http.key_file: instance.key
security.ssl.http.ca_file: ca.crt

security.allow_default_init_securityindex: true

security.nodes_dn:
  - 'CN=infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'

security.restapi.roles_enabled: [ "superuser", "security_rest_api_access" ]

security.system_indices.enabled: true
security.ssl.http.clientauth_mode: OPTIONAL
security.system_indices.indices: [".infini-*"]

#for admin dn
## specify admin certs to operate against system indices, basic_auth is not required
##  curl -k  --cert config/admin.crt --key config/admin.key   -XDELETE 'https://localhost:9200/.infini-*/'
security.authcz.admin_dn:
  - 'CN=admin.infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'
EOF

#根据实际机器内存的大小进行配置,推荐配置为机器内存一半,且不超过31G
sed -i "s/1g/4g/g" $ES_HOME/config/jvm.options

备份目录及权限调整

#创建备份目录
mkdir -p /data/easysearch/backup
#更新目录权限
chown -R es.es /data/easysearch

环境变量及启动服务

su - es
grep -wq easysearch ~/.bashrc || cat<<EOF >> ~/.bashrc
export ES_HOME=/data/easysearch
EOF
source ~/.bashrc

#以后台方式启动服务
$ES_HOME/bin/easysearch -d

Easysearch 验证

curl -ku "admin:$pass" https://127.0.0.1:9200
curl -ku "admin:$pass" https://127.0.0.1:9200/_cluster/health?pretty
curl -ku "admin:$pass" https://127.0.0.1:9200/_cat/nodes?v

部署 Console

curl -sSL http://get.infini.sh | bash -s -- -p console

#安装服务并启动
cd /opt/console
./console-linux-arm64 -service install
./console-linux-arm64 -service start

#验证
systemctl status console

部署 Agent

curl -sSL http://get.infini.sh | bash -s -- -p agent

#修改Agent配置文件
cd /opt/agent
sed -i "/ES_ENDPOINT:/ s|\(.*\: \).*|\1$https://localhost:9200|" agent.yml
sed -i "/ES_USER:/ s|\(.*\: \).*|\1admin|" agent.yml
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
sed -i "/API_BINDING:/ s|\(.*\: \).*|\1\"0.0.0.0:8080\"|" agent.yml
head -n 5 agent.yml

#安装服务并启动
./agent-linux-arm64 -service install
./agent-linux-arm64 -service start

#验证
systemctl status agent

部署 Gateway

curl -sSL http://get.infini.sh | bash -s -- -p gateway
cd /opt/gateway

#修改Gateway配置文件
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
head -n 10 gateway.yml

#安装服务并启动
./gateway-linux-arm64 -service install
./gateway-linux-arm64 -service start

#检查服务
systemctl status gateway
curl -u "admin:$pass" http://127.0.0.1:8000

部署 Loadgen

curl -sSL http://get.infini.sh | bash -s -- -p loadgen

#写入数据测试
cd /opt/loadgen
mkdir -p mock
cat <<EOF > mock/nginx.log
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET / HTTP/1.1" 200 8676 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 17235 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/daterangepicker/daterangepicker.css HTTP/1.1" 200 1700 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/v5-compat.css HTTP/1.1" 200 2091 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/font/raleway.css HTTP/1.1" 200 145 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/fork-awesome.css HTTP/1.1" 200 8401 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/overrides.css HTTP/1.1" 200 2524 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/theme.css HTTP/1.1" 200 306 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fancytree/css/ui.fancytree.css HTTP/1.1" 200 3456 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /syncthing/development/logbar.js HTTP/1.1" 200 486 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
EOF

cat <<EOF > loadgen.yml
env:
  ES_USERNAME: admin
  ES_PASSWORD: $pass
  ES_ENDPOINT: http://localhost:8000
runner:
  # total_rounds: 1
  no_warm: false
  # Whether to log all requests
  log_requests: false
  # Whether to log all requests with the specified response status
  log_status_codes:
    - 0
    - 500
  assert_invalid: false
  assert_error: false
variables:
  - name: ip
    type: file
    path: dict/ip.txt
  - name: message
    type: file
    path: mock/nginx.log
    replace: # replace special characters in the value
      '"': '\"'
      '\': '\\'
  - name: user
    type: file
    path: dict/user.txt
  - name: id
    type: sequence
  - name: uuid
    type: uuid
  - name: now_local
    type: now_local
  - name: now_utc
    type: now_utc
  - name: now_unix
    type: now_unix
  - name: suffix
    type: range
    from: 10
    to: 13
requests:
  - request:
      method: POST
      runtime_variables:
        batch_no: uuid
      runtime_body_line_variables:
        routing_no: uuid
      basic_auth:
        username: $[[env.ES_USERNAME]]
        password: $[[env.ES_PASSWORD]]
      url: $[[env.ES_ENDPOINT]]/_bulk
      body_repeat_times: 5000
      body: |
        { "index" : { "_index" : "test-$[[suffix]]", "_id" : "$[[uuid]]" } }
        { "id" : "$[[uuid]]","routing_no" : "$[[routing_no]]","batch_number" : "$[[batch_no]]","message" : "$[[message]]","random_no" : "$[[suffix]]","ip" : "$[[ip]]","now_local" : "$[[now_local]]","now_unix" : "$[[now_unix]]" }
EOF

#执行测试
./loadgen-linux-arm64 -c 6 -d 6 --compress

#检查测试索引文档
curl -u "admin:$pass" http://127.0.0.1:8000/_cat/indices/test*?v

至此,完成在 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen。通过浏览器 http://安装机器 IP:9000/ 即可访问 Console,对 Easysearch 进行配置管理。

助力 Elasticsearch 国产化,极限科技受邀参加 2023 移动云大会

默认分类liaosy 发表了文章 • 0 个评论 • 2911 次浏览 • 2023-05-10 18:03 • 来自相关话题

近日,2023 移动云大会“数据库&云原生创新”论坛 在苏州隆重召开。现场精英荟萃、专家云集,共同探讨数据库与云原生技术发展及应用落地方案,为助力推动云原生数据库产业发展建言献策。极限科技创始人兼 CEO 曾勇受邀出席论坛。

会上,极限科技创始人兼 CEO 曾勇针对《Elasticsearch 国产化在移动云的演进之路》主题进行演讲,演讲围绕了什么是 Elasticsearch 以及 Elasticsearch 在移动云上的国产化演进过程。

Elasticsearch 在移动云的演进

随着数字化转型的不断深化,非结构化数据日益成为各类组织数据的增长主力,但其在管理和应用方面仍面临模态多样、管理复杂、检索挖掘难度大等挑战。为此,极限科技与移动云共同研发出搜索型数据库软件 Easysearch。

“Easysearch” 是极限科技在 Elasticsearch 软件原版本基础上,立足中国企业需求,助力移动云打造更符合其需求,独具 8 大特色功能的自有开源平替版本系统。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

移动云版本 “Easysearch” 精简 Kernel ,只保留开源核心能力,回归轻量化;增强内核后,可更稳定可靠地支持万亿级数据规模;为进一步增强安全能力,系统支持字段内容脱敏的同时对字段级别采取权限控制;可降低灾难恢复时间,系统具备完整的备份与容灾能力,可实时切换;为更好地服务业务场景,此版本更关注搜索场景的优化;增强型中文分词,提供本地化的词库与拼音支持;增强数据压缩能力后,最高可降低 40%存储空间;信创兼容的系统,支持适配国产操作系统和 CPU 芯片。

目前 Elasticsearch 为移动云提供的后端架构,已由基于 Docker 容器的“移动云 ES v1.0”升级为基于 K8s 架构的“移动云 ES v2.0”版本。其优势可以体现在:

  • 新版本更具自主可控性,应对新需求更具灵活性;
  • 基于 K8s 架构的系统,能支持更大规模的集群服务;
  • 在支持全链路 IPv6 和本地磁盘(IO 隔离)的基础上,实现了更优性能的升级。

Elasticsearch 在中国已有近十万+开发者,上万家企业已经在生产环境大规模运行 Elasticsearch,服务客户包括知名互联网公司及大型企事业单位,覆盖全国范围内生活消费、金融投资、娱乐学习、软件应用与安全等领域知名企业。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

极限科技创始成员多来自 Elasticsearch 中国团队,深耕搜索及 Elasticsearch 十多年,且运营有国内最大的开源搜索技术社区,极限科技团队具备雄厚的技术实力和丰富的相关行业经验技术积累。

国产化替代的首选方案“Easysearch”

目前实时大数据搜索分析,尤其是结构化和非结构化数据结合的场景和需求非常大。针对海量数据,搜索技术成为核心,大多数企业都有不止部署一套搜索后端服务来满足各个场景的搜索业务需求。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

Easysearch 的目标是提供一个轻量级的 Elasticsearch 可替代版本,并继续完善和支持更多的企业级功能。该软件衍生自开源的搜索引擎软件 Elasticsearch,具备相当的接口兼容能力,对于目前国内广大的 Elasticsearch 用户来说切换和接入的成本非常低。

与 Elasticsearch 相比,Easysearch 更关注在搜索业务场景的优化和继续保持其产品的简洁与易用性。基于团队在搜索和 Elasticsearch 生态的多年深耕,极限科技已具备完全自主自研可控能力,Easysearch 因更符合国产搜索技术生态需求,目前逐渐成为 Elasticsearch 国产化替代的首选方案。

作为一款具备自主可控的分布式近实时搜索型数据库产品 Easysearch 具备高性能、高可用、弹性伸缩、高安全性等特性,支持丰富的个性化搜索及聚合分析,且能承载 PB 级别的海量业务数据,可部署在物理机、虚拟机、容器、私有云和公有云,为金融核心系统、运营商、制造业和政企业务系统提供安全、稳定、可靠的快速检索和实时数据探索分析能力,满足不同业务场景的各项复杂需求。

持续丰富完善企业级服务能力

随着国内搜索型数据库的迅速发展,关键技术逐渐突破,应用场景和数据规模也逐年上升,已经成为企业必不可少的核心基础设施,产业生态日益繁荣。

截至目前,极限科技与移动云合作共建的 Easysearch 系统,已在无锡、呼和浩特、南基这 3 个城市上线,此外还有北京、上海、重庆、宁波、海南等 9 个城市的资源池正在上线中。-- 极限科技创始人兼 CEO 曾勇介绍道。

作为全球领先的近实时搜索数据库技术提供商,极限科技始终致力于搜索核心技术的研发与创新,基于国内搜索型数据库行业生态需求,在产品研发创新上,着力提升产品易用性、实时性、降低 IT 成本等,为推动国内搜索行业技术水平及相关技术社区的发展,建设数据强国提供强有力的基础技术支撑。

极限科技自成立起始终致力于提供本地化配套产品及解决方案,帮助客户解决在使用 Elasticsearch 时遇到的各种挑战。未来,极限科技将基于更多的真实客户场景提供个性化服务,持续丰富并完善更多维度、更高需求的企业级服务能力,与移动云等众多行业平台一起构建更“简单”的搜索服务。

关于极限科技

极限科技,全称极限数据(北京)科技有限公司,是一家专注于实时搜索与数据分析的软件公司。旗下品牌极限实验室(INFINI Labs)致力于打造极致易用的数据探索与分析体验。让搜索更简单是我们追求的目标。

极限科技是一支年轻的团队,采用天然分布式的方式来进行远程协作,员工分布在全球各地,希望通过努力成为中国乃至全球企业大数据实时搜索分析产品的首选,为中国技术品牌输出添砖加瓦。

更多详情参见官网 (https://infinilabs.com) 。

让 Easysearch 运行在 LoongArch(3C5000L) 上

EasysearchHardy 发表了文章 • 3 个评论 • 1759 次浏览 • 2023-09-11 12:53 • 来自相关话题

简介

在上一次,我介绍了在国产操作系统 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen,小伙伴们可查看原文。今天我重点介绍下在 Loongnix-Server Linux release 8.4.1 (3C5000L)上安装 Easysearch。

系统配置

在安装之前,需要先进行系统参数调整并创建操作用户,以下命令均需要使用 root 用户操作。

#配置nofile和memlock
tee /etc/security/limits.d/21-infini.conf <<-'EOF'
*                soft    nofile         1048576
*                hard    nofile         1048576
*                soft    memlock        unlimited
*                hard    memlock        unlimited
root             soft    nofile         1048576
root             hard    nofile         1048576
root             soft    memlock        unlimited
root             hard    memlock        unlimited
EOF

#关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
grep -i HugePages_Total /proc/meminfo

grep -wq transparent_hugepage /etc/rc.local || cat <<-'EOF' >> /etc/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod 755 /etc/rc.local

#内核调优
tee /etc/sysctl.d/70-infini.conf <<-'EOF'
vm.max_map_count = 262145
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.ip_local_port_range = 1024 65535
EOF
sysctl -p /etc/sysctl.d/70-infini.conf

用户配置

#创建Easysearch操作用户
groupadd -g 602 es
useradd -u 602 -g es -m -d /home/es -c 'easysearch' -s /bin/bash es

配置 JDK

#在各个节点上分别操作
wget -N http://ftp.loongnix.cn/Java/openjdk17/loongson17.4.0-fx-jdk17.0.6_10-linux-loongarch64.tar.gz -P /usr/src

mkdir -p /usr/local/jdk
tar -zxf /usr/src/loongson*.tar.gz -C /usr/local/jdk --strip-components 1

tee /etc/profile.d/java.sh <<-'EOF'
# set java environment
JAVA_HOME=/usr/local/jdk
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
EOF
source /etc/profile
java -version

Easysearch 部署

部署及密码配置

#在线安装
curl -sSL http://get.infini.sh | bash -s -- -p easysearch -d /data/easysearch
#初始化证书(若不采用默认证书,如需要调整证书可修改证书生成文件)
cd /data/easysearch
#默认会生成随机密码
bin/initialize.sh
ll /data/easysearch/config/{*.crt,*.key,*.pem}

配置文件及 JVM 调整

cat <<EOF > /data/easysearch/config/easysearch.yml
cluster.name: infinilabs
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

cluster.initial_master_nodes: ["node-1"]

path.home: /data/easysearch
path.data: /data/easysearch/data
path.logs: /data/easysearch/logs

http.compression: true

security.enabled: true
security.audit.type: noop
security.ssl.transport.cert_file: instance.crt
security.ssl.transport.key_file: instance.key
security.ssl.transport.ca_file: ca.crt
security.ssl.transport.skip_domain_verify: true
security.ssl.http.enabled: true
security.ssl.http.cert_file: instance.crt
security.ssl.http.key_file: instance.key
security.ssl.http.ca_file: ca.crt

security.allow_default_init_securityindex: true

security.nodes_dn:
  - 'CN=infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'

security.restapi.roles_enabled: [ "superuser", "security_rest_api_access" ]

security.system_indices.enabled: true
security.ssl.http.clientauth_mode: OPTIONAL
security.system_indices.indices: [".infini-*"]

#for admin dn
## specify admin certs to operate against system indices, basic_auth is not required
##  curl -k  --cert config/admin.crt --key config/admin.key   -XDELETE 'https://localhost:9200/.infini-*/'
security.authcz.admin_dn:
  - 'CN=admin.infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'
EOF

#根据实际机器内存的大小进行配置,推荐配置为机器内存一半,且不超过31G
sed -i "s/1g/4g/g" $ES_HOME/config/jvm.options

备份目录及权限调整

#创建备份目录
mkdir -p /data/easysearch/backup
#更新目录权限
chown -R es.es /data/easysearch

环境变量及启动服务

su - es
grep -wq easysearch ~/.bashrc || cat<<EOF >> ~/.bashrc
export ES_HOME=/data/easysearch
EOF
source ~/.bashrc

#jna替换<龙芯平台有独立的jna实现>
rm -rvf $ES_HOME/lib/jna*.jar
wget -N https://release.infinilabs.com/easysearch/archive/jna/loongarch64/jna-5.12.1.jar -P $ES_HOME/lib

#以后台方式启动服务
$ES_HOME/bin/easysearch -d

Easysearch 验证

curl -ku "admin:$pass" https://127.0.0.1:9200
curl -ku "admin:$pass" https://127.0.0.1:9200/_cluster/health?pretty
curl -ku "admin:$pass" https://127.0.0.1:9200/_cat/nodes?v

Easysearch信息

部署 Console

curl -sSL http://get.infini.sh | bash -s -- -p console

#安装服务并启动
cd /opt/console
./console-linux-loong64 -service install
./console-linux-loong64 -service start

#验证
systemctl status console

部署 Agent

curl -sSL http://get.infini.sh | bash -s -- -p agent

#修改Agent配置文件
cd /opt/agent
sed -i "/ES_ENDPOINT:/ s|\(.*\: \).*|\1$https://localhost:9200|" agent.yml
sed -i "/ES_USER:/ s|\(.*\: \).*|\1admin|" agent.yml
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
sed -i "/API_BINDING:/ s|\(.*\: \).*|\1\"0.0.0.0:8080\"|" agent.yml
head -n 5 agent.yml

#安装服务并启动
./agent-linux-loong64 -service install
./agent-linux-loong64 -service start

#验证
systemctl status agent

部署 Gateway

curl -sSL http://get.infini.sh | bash -s -- -p gateway
cd /opt/gateway

#修改Gateway配置文件
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
head -n 10 gateway.yml

#安装服务并启动
./gateway-linux-loong64 -service install
./gateway-linux-loong64 -service start

#检查服务
systemctl status gateway
curl -u "admin:$pass" http://127.0.0.1:8000

部署 Loadgen

curl -sSL http://get.infini.sh | bash -s -- -p loadgen

#写入数据测试
cd /opt/loadgen
mkdir -p mock
cat <<EOF > mock/nginx.log
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET / HTTP/1.1" 200 8676 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 17235 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/daterangepicker/daterangepicker.css HTTP/1.1" 200 1700 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/v5-compat.css HTTP/1.1" 200 2091 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/font/raleway.css HTTP/1.1" 200 145 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/fork-awesome.css HTTP/1.1" 200 8401 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/overrides.css HTTP/1.1" 200 2524 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/theme.css HTTP/1.1" 200 306 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fancytree/css/ui.fancytree.css HTTP/1.1" 200 3456 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /syncthing/development/logbar.js HTTP/1.1" 200 486 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
EOF

cat <<EOF > loadgen.yml
env:
  ES_USERNAME: admin
  ES_PASSWORD: $pass
  ES_ENDPOINT: http://localhost:8000
runner:
  # total_rounds: 1
  no_warm: false
  # Whether to log all requests
  log_requests: false
  # Whether to log all requests with the specified response status
  log_status_codes:
    - 0
    - 500
  assert_invalid: false
  assert_error: false
variables:
  - name: ip
    type: file
    path: dict/ip.txt
  - name: message
    type: file
    path: mock/nginx.log
    replace: # replace special characters in the value
      '"': '\"'
      '\': '\\'
  - name: user
    type: file
    path: dict/user.txt
  - name: id
    type: sequence
  - name: uuid
    type: uuid
  - name: now_local
    type: now_local
  - name: now_utc
    type: now_utc
  - name: now_unix
    type: now_unix
  - name: suffix
    type: range
    from: 10
    to: 13
requests:
  - request:
      method: POST
      runtime_variables:
        batch_no: uuid
      runtime_body_line_variables:
        routing_no: uuid
      basic_auth:
        username: $[[env.ES_USERNAME]]
        password: $[[env.ES_PASSWORD]]
      url: $[[env.ES_ENDPOINT]]/_bulk
      body_repeat_times: 5000
      body: |
        { "index" : { "_index" : "test-$[[suffix]]", "_id" : "$[[uuid]]" } }
        { "id" : "$[[uuid]]","routing_no" : "$[[routing_no]]","batch_number" : "$[[batch_no]]","message" : "$[[message]]","random_no" : "$[[suffix]]","ip" : "$[[ip]]","now_local" : "$[[now_local]]","now_unix" : "$[[now_unix]]" }
EOF

#执行测试
./loadgen-linux-loong64 -c 6 -d 6 --compress

#检查测试索引文档
curl -u "admin:$pass" http://127.0.0.1:8000/_cat/indices/test*?v

至此,完成在 LoongArch(3C5000L)上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen。通过浏览器 http://机器域名:9000/ 即可访问 Console,对 Easysearch 进行配置管理。

可能遇到的问题

连接被拒绝

检查下配置文件中监听的地址是否正确,防火墙是否有关闭。

防火墙状态

关于 Easysearch

about easysearch

INFINI Easysearch 是一个分布式的近实时搜索与分析引擎,核心引擎基于开源的 Apache Lucene。Easysearch 的目标是提供一个轻量级的 Elasticsearch 可替代版本,并继续完善和支持更多的企业级功能。 与 Elasticsearch 相比,Easysearch 更关注在搜索业务场景的优化和继续保持其产品的简洁与易用性。

官网文档:https://www.infinilabs.com/docs/latest/easysearch

下载地址:https://www.infinilabs.com/download

让 Easysearch 运行在 Kylin V10 (Lance)-aarch64 上

EasysearchHardy 发表了文章 • 0 个评论 • 3138 次浏览 • 2023-06-07 11:08 • 来自相关话题

简介

本文主要介绍在国产操作系统 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen

系统配置

在安装之前,需要先进行系统参数调整并创建操作用户,以下命令均需要使用 root 用户操作。

#配置nofile和memlock
tee /etc/security/limits.d/21-infini.conf <<-'EOF'
*                soft    nofile         1048576
*                hard    nofile         1048576
*                soft    memlock        unlimited
*                hard    memlock        unlimited
root             soft    nofile         1048576
root             hard    nofile         1048576
root             soft    memlock        unlimited
root             hard    memlock        unlimited
EOF

#关闭THP
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
grep -i HugePages_Total /proc/meminfo

grep -wq transparent_hugepage /etc/rc.local || cat <<-'EOF' >> /etc/rc.local

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
EOF
chmod 755 /etc/rc.local

#内核调优
tee /etc/sysctl.d/70-infini.conf <<-'EOF'
vm.max_map_count = 262145
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 65535
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 900
net.ipv4.tcp_max_tw_buckets = 2000000
net.ipv4.ip_local_port_range = 1024 65535
EOF
sysctl -p /etc/sysctl.d/70-infini.conf

用户配置

#创建Easysearch操作用户
groupadd -g 602 es
useradd -u 602 -g es -m -d /home/es -c 'easysearch' -s /bin/bash es

配置 JDK

#在各个节点上分别操作
wget -N https://release.infinilabs.com/easysearch/jdk/zulu17.40.19-ca-jdk17.0.6-linux_aarch64.tar.gz -P /usr/src

mkdir -p /usr/local/jdk
tar -zxf /usr/src/zulu*.tar.gz -C /usr/local/jdk --strip-components 1

tee /etc/profile.d/java.sh <<-'EOF'
# set java environment
JAVA_HOME=/usr/local/jdk
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
EOF
source /etc/profile
java -version

Easysearch 部署

部署及密码配置

#在线安装
curl -sSL http://get.infini.sh | bash -s -- -p easysearch -d /data/easysearch
#初始化证书(若不采用默认证书,如需要调整证书可修改证书生成文件)
cd /data/easysearch
bin/initialize.sh
ll /data/easysearch/config/{*.crt,*.key,*.pem}

#调整默认密码及服务配置文件
export ES_HOME=/data/easysearch
pass=`tr -cd 'a-zA-Z0-9!@#$%' </dev/urandom | head -c20`
#记录密码后,删除该文件
echo $pass > /tmp/pass
hash=`$ES_HOME/bin/hash_password.sh -p $pass`
echo $hash

#更新密码字段
cat <<EOF > $ES_HOME/config/security/user.yml
meta:
  type: "user"
  config_version: 2

# Define your internal users here

## Admin users
admin:
  hash: "$hash"
  reserved: true
  external_roles:
    - "admin"
  description: "Admin user"
EOF

配置文件及 JVM 调整

cat <<EOF > /data/easysearch/config/easysearch.yml
cluster.name: infinilabs
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
bootstrap.memory_lock: false
bootstrap.system_call_filter: false

cluster.initial_master_nodes: ["node-1"]

path.home: /data/easysearch
path.data: /data/easysearch/data
path.logs: /data/easysearch/logs

http.compression: true

security.enabled: true
security.audit.type: noop
security.ssl.transport.cert_file: instance.crt
security.ssl.transport.key_file: instance.key
security.ssl.transport.ca_file: ca.crt
security.ssl.transport.skip_domain_verify: true
security.ssl.http.enabled: true
security.ssl.http.cert_file: instance.crt
security.ssl.http.key_file: instance.key
security.ssl.http.ca_file: ca.crt

security.allow_default_init_securityindex: true

security.nodes_dn:
  - 'CN=infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'

security.restapi.roles_enabled: [ "superuser", "security_rest_api_access" ]

security.system_indices.enabled: true
security.ssl.http.clientauth_mode: OPTIONAL
security.system_indices.indices: [".infini-*"]

#for admin dn
## specify admin certs to operate against system indices, basic_auth is not required
##  curl -k  --cert config/admin.crt --key config/admin.key   -XDELETE 'https://localhost:9200/.infini-*/'
security.authcz.admin_dn:
  - 'CN=admin.infini.cloud,OU=UNIT,O=ORG,L=NI,ST=FI,C=IN'
EOF

#根据实际机器内存的大小进行配置,推荐配置为机器内存一半,且不超过31G
sed -i "s/1g/4g/g" $ES_HOME/config/jvm.options

备份目录及权限调整

#创建备份目录
mkdir -p /data/easysearch/backup
#更新目录权限
chown -R es.es /data/easysearch

环境变量及启动服务

su - es
grep -wq easysearch ~/.bashrc || cat<<EOF >> ~/.bashrc
export ES_HOME=/data/easysearch
EOF
source ~/.bashrc

#以后台方式启动服务
$ES_HOME/bin/easysearch -d

Easysearch 验证

curl -ku "admin:$pass" https://127.0.0.1:9200
curl -ku "admin:$pass" https://127.0.0.1:9200/_cluster/health?pretty
curl -ku "admin:$pass" https://127.0.0.1:9200/_cat/nodes?v

部署 Console

curl -sSL http://get.infini.sh | bash -s -- -p console

#安装服务并启动
cd /opt/console
./console-linux-arm64 -service install
./console-linux-arm64 -service start

#验证
systemctl status console

部署 Agent

curl -sSL http://get.infini.sh | bash -s -- -p agent

#修改Agent配置文件
cd /opt/agent
sed -i "/ES_ENDPOINT:/ s|\(.*\: \).*|\1$https://localhost:9200|" agent.yml
sed -i "/ES_USER:/ s|\(.*\: \).*|\1admin|" agent.yml
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
sed -i "/API_BINDING:/ s|\(.*\: \).*|\1\"0.0.0.0:8080\"|" agent.yml
head -n 5 agent.yml

#安装服务并启动
./agent-linux-arm64 -service install
./agent-linux-arm64 -service start

#验证
systemctl status agent

部署 Gateway

curl -sSL http://get.infini.sh | bash -s -- -p gateway
cd /opt/gateway

#修改Gateway配置文件
sed -i "/ES_PASS:/ s|\(.*\: \).*|\1$pass|" gateway.yml
head -n 10 gateway.yml

#安装服务并启动
./gateway-linux-arm64 -service install
./gateway-linux-arm64 -service start

#检查服务
systemctl status gateway
curl -u "admin:$pass" http://127.0.0.1:8000

部署 Loadgen

curl -sSL http://get.infini.sh | bash -s -- -p loadgen

#写入数据测试
cd /opt/loadgen
mkdir -p mock
cat <<EOF > mock/nginx.log
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET / HTTP/1.1" 200 8676 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/bootstrap/css/bootstrap.css HTTP/1.1" 200 17235 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/daterangepicker/daterangepicker.css HTTP/1.1" 200 1700 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/v5-compat.css HTTP/1.1" 200 2091 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/font/raleway.css HTTP/1.1" 200 145 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fork-awesome/css/fork-awesome.css HTTP/1.1" 200 8401 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/overrides.css HTTP/1.1" 200 2524 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /assets/css/theme.css HTTP/1.1" 200 306 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /vendor/fancytree/css/ui.fancytree.css HTTP/1.1" 200 3456 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
175.10.75.216 - - [28/Jul/2020:21:20:26 +0800] "GET /syncthing/development/logbar.js HTTP/1.1" 200 486 "http://dl-console.elasticsearch.cn/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36"
EOF

cat <<EOF > loadgen.yml
env:
  ES_USERNAME: admin
  ES_PASSWORD: $pass
  ES_ENDPOINT: http://localhost:8000
runner:
  # total_rounds: 1
  no_warm: false
  # Whether to log all requests
  log_requests: false
  # Whether to log all requests with the specified response status
  log_status_codes:
    - 0
    - 500
  assert_invalid: false
  assert_error: false
variables:
  - name: ip
    type: file
    path: dict/ip.txt
  - name: message
    type: file
    path: mock/nginx.log
    replace: # replace special characters in the value
      '"': '\"'
      '\': '\\'
  - name: user
    type: file
    path: dict/user.txt
  - name: id
    type: sequence
  - name: uuid
    type: uuid
  - name: now_local
    type: now_local
  - name: now_utc
    type: now_utc
  - name: now_unix
    type: now_unix
  - name: suffix
    type: range
    from: 10
    to: 13
requests:
  - request:
      method: POST
      runtime_variables:
        batch_no: uuid
      runtime_body_line_variables:
        routing_no: uuid
      basic_auth:
        username: $[[env.ES_USERNAME]]
        password: $[[env.ES_PASSWORD]]
      url: $[[env.ES_ENDPOINT]]/_bulk
      body_repeat_times: 5000
      body: |
        { "index" : { "_index" : "test-$[[suffix]]", "_id" : "$[[uuid]]" } }
        { "id" : "$[[uuid]]","routing_no" : "$[[routing_no]]","batch_number" : "$[[batch_no]]","message" : "$[[message]]","random_no" : "$[[suffix]]","ip" : "$[[ip]]","now_local" : "$[[now_local]]","now_unix" : "$[[now_unix]]" }
EOF

#执行测试
./loadgen-linux-arm64 -c 6 -d 6 --compress

#检查测试索引文档
curl -u "admin:$pass" http://127.0.0.1:8000/_cat/indices/test*?v

至此,完成在 Kylin V10 (Lance)-aarch64 上安装单机版 Easysearch/Console/Agent/Gateway/Loadgen。通过浏览器 http://安装机器 IP:9000/ 即可访问 Console,对 Easysearch 进行配置管理。

助力 Elasticsearch 国产化,极限科技受邀参加 2023 移动云大会

默认分类liaosy 发表了文章 • 0 个评论 • 2911 次浏览 • 2023-05-10 18:03 • 来自相关话题

近日,2023 移动云大会“数据库&云原生创新”论坛 在苏州隆重召开。现场精英荟萃、专家云集,共同探讨数据库与云原生技术发展及应用落地方案,为助力推动云原生数据库产业发展建言献策。极限科技创始人兼 CEO 曾勇受邀出席论坛。

会上,极限科技创始人兼 CEO 曾勇针对《Elasticsearch 国产化在移动云的演进之路》主题进行演讲,演讲围绕了什么是 Elasticsearch 以及 Elasticsearch 在移动云上的国产化演进过程。

Elasticsearch 在移动云的演进

随着数字化转型的不断深化,非结构化数据日益成为各类组织数据的增长主力,但其在管理和应用方面仍面临模态多样、管理复杂、检索挖掘难度大等挑战。为此,极限科技与移动云共同研发出搜索型数据库软件 Easysearch。

“Easysearch” 是极限科技在 Elasticsearch 软件原版本基础上,立足中国企业需求,助力移动云打造更符合其需求,独具 8 大特色功能的自有开源平替版本系统。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

移动云版本 “Easysearch” 精简 Kernel ,只保留开源核心能力,回归轻量化;增强内核后,可更稳定可靠地支持万亿级数据规模;为进一步增强安全能力,系统支持字段内容脱敏的同时对字段级别采取权限控制;可降低灾难恢复时间,系统具备完整的备份与容灾能力,可实时切换;为更好地服务业务场景,此版本更关注搜索场景的优化;增强型中文分词,提供本地化的词库与拼音支持;增强数据压缩能力后,最高可降低 40%存储空间;信创兼容的系统,支持适配国产操作系统和 CPU 芯片。

目前 Elasticsearch 为移动云提供的后端架构,已由基于 Docker 容器的“移动云 ES v1.0”升级为基于 K8s 架构的“移动云 ES v2.0”版本。其优势可以体现在:

  • 新版本更具自主可控性,应对新需求更具灵活性;
  • 基于 K8s 架构的系统,能支持更大规模的集群服务;
  • 在支持全链路 IPv6 和本地磁盘(IO 隔离)的基础上,实现了更优性能的升级。

Elasticsearch 在中国已有近十万+开发者,上万家企业已经在生产环境大规模运行 Elasticsearch,服务客户包括知名互联网公司及大型企事业单位,覆盖全国范围内生活消费、金融投资、娱乐学习、软件应用与安全等领域知名企业。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

极限科技创始成员多来自 Elasticsearch 中国团队,深耕搜索及 Elasticsearch 十多年,且运营有国内最大的开源搜索技术社区,极限科技团队具备雄厚的技术实力和丰富的相关行业经验技术积累。

国产化替代的首选方案“Easysearch”

目前实时大数据搜索分析,尤其是结构化和非结构化数据结合的场景和需求非常大。针对海量数据,搜索技术成为核心,大多数企业都有不止部署一套搜索后端服务来满足各个场景的搜索业务需求。-- 极限科技创始人兼 CEO 曾勇在会上介绍道

Easysearch 的目标是提供一个轻量级的 Elasticsearch 可替代版本,并继续完善和支持更多的企业级功能。该软件衍生自开源的搜索引擎软件 Elasticsearch,具备相当的接口兼容能力,对于目前国内广大的 Elasticsearch 用户来说切换和接入的成本非常低。

与 Elasticsearch 相比,Easysearch 更关注在搜索业务场景的优化和继续保持其产品的简洁与易用性。基于团队在搜索和 Elasticsearch 生态的多年深耕,极限科技已具备完全自主自研可控能力,Easysearch 因更符合国产搜索技术生态需求,目前逐渐成为 Elasticsearch 国产化替代的首选方案。

作为一款具备自主可控的分布式近实时搜索型数据库产品 Easysearch 具备高性能、高可用、弹性伸缩、高安全性等特性,支持丰富的个性化搜索及聚合分析,且能承载 PB 级别的海量业务数据,可部署在物理机、虚拟机、容器、私有云和公有云,为金融核心系统、运营商、制造业和政企业务系统提供安全、稳定、可靠的快速检索和实时数据探索分析能力,满足不同业务场景的各项复杂需求。

持续丰富完善企业级服务能力

随着国内搜索型数据库的迅速发展,关键技术逐渐突破,应用场景和数据规模也逐年上升,已经成为企业必不可少的核心基础设施,产业生态日益繁荣。

截至目前,极限科技与移动云合作共建的 Easysearch 系统,已在无锡、呼和浩特、南基这 3 个城市上线,此外还有北京、上海、重庆、宁波、海南等 9 个城市的资源池正在上线中。-- 极限科技创始人兼 CEO 曾勇介绍道。

作为全球领先的近实时搜索数据库技术提供商,极限科技始终致力于搜索核心技术的研发与创新,基于国内搜索型数据库行业生态需求,在产品研发创新上,着力提升产品易用性、实时性、降低 IT 成本等,为推动国内搜索行业技术水平及相关技术社区的发展,建设数据强国提供强有力的基础技术支撑。

极限科技自成立起始终致力于提供本地化配套产品及解决方案,帮助客户解决在使用 Elasticsearch 时遇到的各种挑战。未来,极限科技将基于更多的真实客户场景提供个性化服务,持续丰富并完善更多维度、更高需求的企业级服务能力,与移动云等众多行业平台一起构建更“简单”的搜索服务。

关于极限科技

极限科技,全称极限数据(北京)科技有限公司,是一家专注于实时搜索与数据分析的软件公司。旗下品牌极限实验室(INFINI Labs)致力于打造极致易用的数据探索与分析体验。让搜索更简单是我们追求的目标。

极限科技是一支年轻的团队,采用天然分布式的方式来进行远程协作,员工分布在全球各地,希望通过努力成为中国乃至全球企业大数据实时搜索分析产品的首选,为中国技术品牌输出添砖加瓦。

更多详情参见官网 (https://infinilabs.com) 。