wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.1.3-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.1.3-linux-x86_64.tar.gz.sha512
# shasum -a 512 -c elasticsearch-8.1.3-linux-x86_64.tar.gz.sha512
tar -xzvf elasticsearch-8.1.3-linux-x86_64.tar.gz
# elasticsearch用户提前建立
sudo chown -R elasticsearch:elasticsearch /es/elasticsearch-8.1.3
# 启动node1
./bin/elasticsearch
# 启动成功后可修改密码
./elasticsearch-reset-password -i -u elastic
- 启用身份验证和授权,并为
elastic内置超级用户生成密码。- 为传输层和 HTTP 层生成 TLS 的证书和密钥,并使用这些密钥和证书启用和配置 TLS。
- 为 Kibana 生成一个注册令牌,有效期为 30 分钟。
✅ Elasticsearch security features have been automatically configured!
✅ Authentication is enabled and cluster connections are encrypted.
ℹ️ Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
Y*bv6n6Ghbi_gDvPI2_*
ℹ️ HTTP CA certificate SHA-256 fingerprint:
1c1b9e6cc3a1468b586876da80ee3098fc7edd536eeb63f4450ce9bd426d6749
ℹ️ Configure Kibana to use this cluster:
• Run Kibana and click the configuration link in the terminal when Kibana starts.
• Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxOTIuMTY4LjMxLjEzMzo5MjAxIl0sImZnciI6IjFjMWI5ZTZjYzNhMTQ2OGI1ODY4NzZkYTgwZWUzMDk4ZmM3ZWRkNTM2ZWViNjNmNDQ1MGNlOWJkNDI2ZDY3NDkiLCJrZXkiOiJsQkZVZzRBQmN6b00yT0hMcmtkNzpKbFpUU09FQlJZbW44T3UwempPWm9RIn0=
ℹ️ Configure other nodes to join this cluster:
• Copy the following enrollment token and start new Elasticsearch nodes with `bin/elasticsearch --enrollment-token <token>` (valid for the next 30 minutes):
eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxOTIuMTY4LjMxLjEzMzo5MjAxIl0sImZnciI6IjFjMWI5ZTZjYzNhMTQ2OGI1ODY4NzZkYTgwZWUzMDk4ZmM3ZWRkNTM2ZWViNjNmNDQ1MGNlOWJkNDI2ZDY3NDkiLCJrZXkiOiJraEZVZzRBQmN6b00yT0hMcmtkMDp4dmo3OVp6V1JwcVo3SUJEdnI4V3pBIn0=
If you're running in Docker, copy the enrollment token and run:
`docker run -e "ENROLLMENT_TOKEN=<token>" docker.elastic.co/elasticsearch/elasticsearch:8.1.3`
# 如果token过期,在主节点运行
bin/elasticsearch-create-enrollment-token -s node
# 生成了enrollment-token,新节点的安装目录中,启动 Elasticsearch 并使用--enrollment-token参数传递注册令牌
bin/elasticsearch --enrollment-token <enrollment-token>
# 以下目录会生成证书和密钥
config/certs
# node-1 建议在最初设置,集群建好后不要改,如果要修改只有删除主节点,重新加入集群,参见加入其他节点的操作
cluster.name: cluster133
node.name: node-1
network.host: 192.168.31.133
http.port: 9201
cluster.initial_master_nodes: ["node-1"]
# node-2 (与node-1同ip)
cluster.name: cluster133
node.name: node-2
network.host: 192.168.31.133
http.port: 9202
discovery.seed_hosts: ["127.0.0.1:9301", "192.168.31.133:9301"]
# node-3(另一台)
cluster.name: cluster133
node.name: node-3
network.host: 192.168.31.135
http.port: 9200
discovery.seed_hosts: ["192.168.31.133:9301"]
在第1次连接成功之后,如果以后出现集群启动问题,删除节点中的data目录下所有文件,再次启动即可
1.下载运行
curl -O https://artifacts.elastic.co/downloads/kibana/kibana-8.1.3-linux-x86_64.tar.gz
#curl https://artifacts.elastic.co/downloads/kibana/kibana-8.1.3-linux-x86_64.tar.gz.sha512 | shasum -a 512 -c -
tar -xzf kibana-8.1.3-linux-x86_64.tar.gz
cd kibana-8.1.3/
如果token过期,启动 Elasticsearch 主节点,并为 Kibana 生成一个注册令牌编辑
./elasticsearch-create-enrollment-token -s kibana --url "https://192.168.31.133:9201"
# eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxOTIuMTY4LjMxLjEzMzo5MjAxIl0sImZnciI6IjFjMWI5ZTZjYzNhMTQ2OGI1ODY4NzZkYTgwZWUzMDk4ZmM3ZWRkNTM2ZWViNjNmNDQ1MGNlOWJkNDI2ZDY3NDkiLCJrZXkiOiJhUUhSZ29BQjhCUHV4TTVheHE0OTpqUWdGaGgxWVFScWM3a3NxOWJuMjRRIn0=
server.host: "192.168.31.133"<本机地址>,便于外网访问)./bin/kibana
# 第一次启动会生成一个localhost:XXX,在浏览器访问此地址,elasticsearch生成的kibana token
docker pull docker.elastic.co/enterprise-search/enterprise-search:8.1.3
如果在 Docker 容器中启动单节点 Elasticsearch 集群,则会自动为您启用和配置安全性。首次启动 Elasticsearch 时,会自动进行以下安全配置:
- 为传输层和 HTTP 层生成 证书和密钥。
- 传输层安全 (TLS) 配置设置被写入
elasticsearch.yml.- 为
elastic用户生成密码。- 为 Kibana 生成一个注册令牌。
# 创建网络
docker network create elastic
# 创建目录和文件
/usr/share/elasticsearch/config/es01/elasticsearch.yml
# elasticsearch.yml中保存
network.host: 0.0.0.0
# 新建用户,授权
useradd Elasticsearch
chown -R Elasticsearch:Elasticsearch /usr/share/elasticsearch/config/
elastic用户生成密码并输出到终端,以及用于注册 Kibana 的注册令牌
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.1.3
docker run -e ES_JAVA_OPTS="-Xms2g -Xmx2g" --name es01 --net elastic -p 9201:9200 -p 9301:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.1.3
# 挂载本地文件夹
docker run -e ES_JAVA_OPTS="-Xms2g -Xmx2g" --name es01 -v ves01:/usr/share/elasticsearch/config --net elastic -p 9201:9200 -p 9301:9300 -it docker.elastic.co/elasticsearch/elasticsearch:8.1.3
------------------------------------------------------------------------------------------------------------------------------------------------------------------
-> Elasticsearch security features have been automatically configured!
-> Authentication is enabled and cluster connections are encrypted.
* elastic的密码
-> Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
HRq90iK3wfBrW7sWPZ*7
-> HTTP CA certificate SHA-256 fingerprint:
4bee7b8c89414f49c6747fe1799c76b8d9d253ea6e779288c868a4f91219c6b7
-> Configure Kibana to use this cluster:
* Run Kibana and click the configuration link in the terminal when Kibana starts.
* Copy the following enrollment token and paste it into Kibana in your browser (valid for the next 30 minutes):
* kibana用token(30分钟有效)
eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNGJlZTdiOGM4OTQxNGY0OWM2NzQ3ZmUxNzk5Yzc2YjhkOWQyNTNlYTZlNzc5Mjg4Yzg2OGE0ZjkxMjE5YzZiNyIsImtleSI6IjFjNk5mWUFCSXpOMVQxT0xYckdwOlQzcDBfWFpYUmNpaDdBV0V1R3RycUEifQ==
-> Configure other nodes to join this cluster:
* Copy the following enrollment token and start new Elasticsearch nodes with `bin/elasticsearch --enrollment-token <token>` (valid for the next 30 minutes):
* 新加节点用的token(30分钟有效)
zIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNGJlZTdiOGM4OTQxNGY0OWM2NzQ3ZmUxNzk5Yzc2YjhkOWQyNTNlYTZlNzc5Mjg4Yzg2OGE0ZjkxMjE5YzZiNyIsImtleSI6IjFzNk5mWUFCSXpOMVQxT0xYckdwOm1oazA1NVJIUmZtYlpfMVhFSHg3b2cifQ==
If you're running in Docker, copy the enrollment token and run:
`docker run -e "ENROLLMENT_TOKEN=<token>" docker.elastic.co/elasticsearch/elasticsearch:8.1.3`
-----------------------------------------------------------------------------------------------------
http_ca.crt安全证书从 Docker 容器复制到本地计算机。# /usr/share/elasticsearch/config/certs/ 先建立此目录,以便下一步文件拷贝
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
5.http_ca.crt打开一个新终端,并使用从 Docker 容器中复制的文件进行经过身份验证的调用,验证是否可以连接到 Elasticsearch 集群。elastic出现提示时输入用户的密码。# 在/usr/share/elasticsearch/config/certs/下运行
curl --cacert http_ca.crt -u elastic https://localhost:9201
elasticsearch-reset-password工具# -i 表示手动输入密码, -u 指用户名
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -i -u elastic
{
"name": "e8472c952c32",
"cluster_name": "docker-cluster",
"cluster_uuid": "tLrgLl74SPiQjoJanYx3bg",
"version": {
"number": "8.1.3",
"build_flavor": "default",
"build_type": "docker",
"build_hash": "39afaa3c0fe7db4869a161985e240bd7182d7a07",
"build_date": "2022-04-19T08:13:25.444693396Z",
"build_snapshot": false,
"lucene_version": "9.0.0",
"minimum_wire_compatibility_version": "7.17.0",
"minimum_index_compatibility_version": "7.0.0"
},
"tagline": "You Know, for Search"
}
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node
ES_JAVA_OPTS设置值# 不指定端口加入,将config目录挂载到ves0x
docker run -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxNzIuMTguMC40OjkyMDAiXSwiZmdyIjoiZjY0ODY1ZjU3YjY0ZjA2Njg2ZGIxZTdlN2FiNDdjNmViMjAyYzBlNzFkMzgwMTY3YmIzZjU1MWQ1YzhmOWRmMCIsImtleSI6Im5zNFZoSUFCcHdDN2dYc1NCcWwzOk56MjY0WEJPU0oyOHdtNWY4NTVkWFEifQ==" -v ves02:/usr/share/elasticsearch/config -e ES_JAVA_OPTS="-Xms1g -Xmx1g" --name es02 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.1.3
docker run -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiZjY0ODY1ZjU3YjY0ZjA2Njg2ZGIxZTdlN2FiNDdjNmViMjAyYzBlNzFkMzgwMTY3YmIzZjU1MWQ1YzhmOWRmMCIsImtleSI6Ik1NenRnNEFCV3N4UDFjYlVqRHJYOi1Hc0JUUFlQVEgyYTFKMjdDYkRWNVEifQ==" -v ves03:/usr/share/elasticsearch/config -e ES_JAVA_OPTS="-Xms1g -Xmx1g" --name es03 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.1.3
# 也可以指定端口映射加入节点
docker run -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiZjY0ODY1ZjU3YjY0ZjA2Njg2ZGIxZTdlN2FiNDdjNmViMjAyYzBlNzFkMzgwMTY3YmIzZjU1MWQ1YzhmOWRmMCIsImtleSI6Ii1aRW5nSUFCTUU2YWFlTFpqMFk1OmVJbkNKVnV0U3VTbHN4QTg0bHRFNkEifQ==" -v ves04:/usr/share/elasticsearch/config -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -p 9202:9200 -p 9302:9300 --name es04 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.1.3
172.18.0.5 27 88 0 0.88 0.46 0.30 cdfhilmrstw - fa20d93534c4
172.18.0.3 24 88 0 0.88 0.46 0.30 cdfhilmrstw - 826f16400df2
172.18.0.4 21 88 0 0.88 0.46 0.30 cdfhilmrstw - 474212145ad2
172.18.0.2 30 88 0 0.88 0.46 0.30 cdfhilmrstw * e8472c952c32
ERROR: Skipping security auto configuration because it appears that the node is not starting up for the first time. The node might already be part of a cluster and this auto setup utility is designed to configure Security for new clusters only.
建议一次将所有从节点的ENROLLMENT_TOKEN删除,再重启
# 将对应id中的config.v2.json修改,删除其中的ENROLLMENT_TOKEN键值对
/var/lib/docker/containers/c4e850f2e79dc7244f19c55fb81f4bfd679f693f96f5f17b0679af7bbfeb8603
前提,已经安装,运行elasticsearch;
1.拉取image,运行container,当启动 Kibana 时,一个唯一的链接会输出到终端,要访问 Kibana,单击终端中生成的链接
docker pull docker.elastic.co/kibana/kibana:8.1.3
docker run --name kib-01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.1.3
Go to http://0.0.0.0:5601/?code=639777 to get started.
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
# 生成的token在 http://xxxx:5601
eyJ2ZXIiOiI4LjEuMyIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiZjY0ODY1ZjU3YjY0ZjA2Njg2ZGIxZTdlN2FiNDdjNmViMjAyYzBlNzFkMzgwMTY3YmIzZjU1MWQ1YzhmOWRmMCIsImtleSI6Im1vSElnNEFCbXNkSmRsTnN6VzRXOk9UQ3hhWWwyVEdPVGs4eS14TlBCYmcifQ==
# 将0.0.0.0替换为kibana ip地址,填入生成的token,用户名/密码,启动成功
http://0.0.0.0:5601/?code=639777
docker compose version
docker-compose version
# Password for the 'elastic' user (at least 6 characters)
ELASTIC_PASSWORD=elastic
#
# # Password for the 'kibana_system' user (at least 6 characters)
KIBANA_PASSWORD=elastic
#
# # Version of Elastic products
STACK_VERSION=8.1.3
#
# # Set the cluster name
CLUSTER_NAME=docker-cluster
#
# # Set to 'basic' or 'trial' to automatically start the 30-day trial
LICENSE=basic
# #LICENSE=trial
#
# # Port to expose Elasticsearch HTTP API to the host
ES_PORT=9200
#ES_PORT=127.0.0.1:9200
#
# # Port to expose Kibana to the host
KIBANA_PORT=5601
#KIBANA_PORT=80
#
# # Increase or decrease based on the available host memory (in bytes)
MEM_LIMIT=1073741824
#
# # Project namespace (defaults to the current folder name if not set)
# #COMPOSE_PROJECT_NAME=myproject
docker-compose.yml复制官网【形成3个es节点+kibana】
参考:https://www.elastic.co/guide/en/elasticsearch/reference/8.1/docker.html
运行
# 启动
docker-compose up -d
# 停止
docker-compose down
验证:浏览器访问centos_ip:5601
# 例如【输入用户名密码登录】
http://192.168.31.133:5601
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
由于fast-stemmer的问题,我很难安装我想要的任何rubygem。我把我得到的错误放在下面。Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingfast-stemmer:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcreatingMakefilemake"DESTDIR="cleanmake"DESTDIR=
当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub
当我执行>rvminstall1.9.2时一切顺利。然后我做>rvmuse1.9.2也很顺利。但是当涉及到ruby-v时..sam@sjones:~$rvminstall1.9.2/home/sam/.rvm/rubies/ruby-1.9.2-p136,thismaytakeawhiledependingonyourcpu(s)...ruby-1.9.2-p136-#fetchingruby-1.9.2-p136-#downloadingruby-1.9.2-p136,thismaytakeawhiledependingonyourconnection...%Total%Rece