国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

elasticsearch 配置用戶(hù)名和密碼

這篇具有很好參考價(jià)值的文章主要介紹了elasticsearch 配置用戶(hù)名和密碼。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

無(wú)密碼的其他配置項(xiàng)在:https://blog.csdn.net/Xeon_CC/article/details/132064295

elasticsearch.yml配置文件:

xpack.security.enabled: true
xpack.security.http.ssl.enabled: true
xpack.security.http.ssl.keystore.path: /path/to/elastic-certificates.p12
xpack.security.transport.ssl: 
    enabled: true
    verification_mode: certificate
    client_authentication: required
    keystore.path: /path/to/elastic-certificates.p12
    truststore.path: /path/to/elastic-certificates.p12
證書(shū)的密碼:
abcd1234

所有用戶(hù)的密碼:
bcda1234

生成證書(shū)
elasticsearch-certutil ca --out /path/to/elastic-stack-ca.p12 --pass abcd1234

如果你不想生成單獨(dú)的證書(shū),也就是三個(gè)節(jié)點(diǎn)共用一個(gè)證書(shū),請(qǐng)不要執(zhí)行這行命令,這行命令將被下文所提到的證書(shū)生成方式代替。
elasticsearch-certutil cert --ca /path/to/elastic-stack-ca.p12

輸入指定路徑
/path/to/elastic-certificates.p12

注意:設(shè)置密碼這一步,三個(gè)節(jié)點(diǎn)都要執(zhí)行。
設(shè)置密碼
elasticsearch-keystore add xpack.security.http.ssl.keystore.secure_password
elasticsearch-keystore add xpack.security.http.ssl.truststore.secure_password
elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password

查看密碼
elasticsearch-keystore show xpack.security.http.ssl.keystore.secure_password
elasticsearch-keystore show xpack.security.http.ssl.truststore.secure_password
elasticsearch-keystore show xpack.security.transport.ssl.truststore.secure_password
elasticsearch-keystore show xpack.security.transport.ssl.keystore.secure_password

如果你希望集群共享一個(gè)整數(shù),那么三個(gè)節(jié)點(diǎn),確保elastic-certificates.p12證書(shū)文件是復(fù)制到每個(gè)節(jié)點(diǎn)的。

設(shè)置為false
xpack.security.http.ssl.enabled: false
修改密碼
elasticsearch-setup-passwords interactive

最后,配置文件改回去
xpack.security.http.ssl.enabled: true

最后在elasticsearch-head訪(fǎng)問(wèn):https://192.168.0.111:9200/?auth_user=xxx&auth_password=xxx

查看證書(shū)過(guò)期時(shí)間:

#生成pem文件
openssl pkcs12 -in /path/to/your/elastic-certificates.p12 -clcerts -nokeys -out extracted_certificate.pem

#通過(guò)pem文件查看證書(shū)過(guò)期時(shí)間:
openssl x509 -in /path/to/your/extracted_certificate.pem -noout -enddate


在上面的“生成證書(shū)”這個(gè)步驟中的第二行命令,可以換為以下的步驟,安全性會(huì)更高,注意,確保存在elastic-stack-ca.p12文件,也就上述“生成證書(shū)”步驟中的第一行命令生成的文件。
首先隨便選擇一個(gè)節(jié)點(diǎn):在任何目錄下創(chuàng)建instances.yml,并鍵入如下內(nèi)容:

instances:
  - name: "node-1"
    dns:
      - "localhost"
    ip:
      - "192.168.1.105"
  - name: "node-2"
    dns:
      - "localhost"
    ip:
      - "192.168.1.105"
  - name: "node-3"
    dns:
      - "localhost"
    ip:
      - "192.168.1.105"

如果要配置公網(wǎng)域名:

instances:
  - name: "node-1"
    dns: ["abc.cde.com", "localhost"]
    ip: ["192.168.1.123"]
  - name: "node-2"
    dns: ["abc.cde.com", "localhost"]
    ip: ["192.168.1.123"]
  - name: "node-3"
    dns: ["abc.cde.com", "localhost"]
    ip: ["192.168.1.123"]

比如我放在config目錄下

elasticsearch-certutil cert --in config/instances.yml --out config/certs/certificates.zip --ca config/certs/elastic-stack-ca.p12 --pass abcd1234

然后,解壓certificates.zip文件,會(huì)得到node-1、node-2、node-3文件夾
把node-1.p12、node-2.p12、node-3.p12復(fù)制到每個(gè)對(duì)應(yīng)es節(jié)點(diǎn)中的config/certs目錄下,certs目錄如果沒(méi)有則自己新建。

最后更改elasticsearch.yml配置文件
elasticsearch 配置用戶(hù)名和密碼,elasticsearch,大數(shù)據(jù)
把這些證書(shū)文件替換為各自的證書(shū)文件。

這種配置方式的安全性要更高,推薦使用這種每個(gè)節(jié)點(diǎn)的證書(shū)都不同的方式。

如何用python通過(guò)SSL證書(shū)連接ES集群?
在每一個(gè)節(jié)點(diǎn)執(zhí)行一下命令:

使用openssl配置客戶(hù)端證書(shū)

openssl pkcs12 -in node-1.p12 -out node-1.crt -nokeys -nodes
openssl pkcs12 -in node-2.p12 -out node-2.crt -nokeys -nodes
openssl pkcs12 -in node-3.p12 -out node-3.crt -nokeys -nodes

然后,合并證書(shū);

type node-1.crt node-2.crt node-3.crt > combined_ca.crt

最后在python中使用combined_ca.crt文件,把服務(wù)器生成的這個(gè)文件拷貝到python項(xiàng)目的目錄中。

es = Elasticsearch(
    ['https://192.168.1.105:9201', 'https://192.168.1.105:9202', 'https://192.168.1.105:9203'],  # 你可以指定一個(gè)或多個(gè)節(jié)點(diǎn)
    http_auth=('elastic', 'your_password'),
    scheme='https',
    use_ssl=True,
    ca_certs='combined_ca.crt', # 指定證書(shū)的路徑。
    verify_certs=True  # 設(shè)置為T(mén)rue意味著客戶(hù)端將驗(yàn)證服務(wù)器的證書(shū)
)

index_name='abccc_2023-08-09'
if not es.indices.exists(index=index_name):
    body = {
        "settings": {
            "number_of_shards": 3,
        },
        "mappings": {
            "properties": {
                "location": {
                    "type": "geo_shape"
                },
                "geo_loctn": {
                    "type": "geo_point"
                }
            }
        }
    }

    es.indices.create(index=index_name, body=body)
    print('create es index ...')

如果能創(chuàng)建索引,說(shuō)明驗(yàn)證成功。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-623404.html

到了這里,關(guān)于elasticsearch 配置用戶(hù)名和密碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶(hù)投稿,該文觀(guān)點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • elasticSearch 設(shè)置用戶(hù)名密碼 && 查詢(xún)

    elasticSearch 設(shè)置用戶(hù)名密碼 && 查詢(xún)

    一、設(shè)置密碼 1.需要在配置文件中開(kāi)啟x-pack驗(yàn)證, 修改config目錄下面的elasticsearch.yml文件,在里面添加如下內(nèi)容,并重啟. 2,執(zhí)行設(shè)置用戶(hù)名和密碼的命令,這里需要為4個(gè)用戶(hù)分別設(shè)置密碼,elastic, kibana, logstash_system,beats_system 網(wǎng)上設(shè)置時(shí)出現(xiàn)的: 我設(shè)置密碼時(shí)出現(xiàn)的: 其中,用

    2024年01月17日
    瀏覽(20)
  • elasticsearch設(shè)置用戶(hù)名和密碼

    1、需要在配置文件中開(kāi)啟x-pack驗(yàn)證:修改config目錄下面的elasticsearch.yml文件,在里面添加如下內(nèi)容 2、重啟es 3、進(jìn)入es的安裝根目錄bin下找到elasticsearch-setup-passwords、并執(zhí)行如下命令 4、執(zhí)行elasticsearch-setup-passwords interactive命令后,這里需要為4個(gè)用戶(hù)分別設(shè)置密碼,elastic, kib

    2024年02月02日
    瀏覽(23)
  • elasticsearch7設(shè)置用戶(hù)名和密碼

    elasticsearch7設(shè)置用戶(hù)名和密碼

    windows ,elasticsearch 在elasticsearch.yml中添加 xpack.security.enabled: true xpack.security.transport.ssl.enabled: true 在es的bin目錄下命令行執(zhí)行:elasticsearch-setup-passwords interactive ? curl -H \\\"Content-Type:application/json\\\" -XPOST -u elastic \\\'http://127.0.0.1:9200/_xpack/security/user/elastic/_password\\\' -d \\\'{ \\\"password\\\" : \\\"123456\\\" }\\\' 修

    2024年02月12日
    瀏覽(21)
  • ElasticSearch沒(méi)有記錄初始化用戶(hù)名密碼

    ElasticSearch沒(méi)有記錄初始化用戶(hù)名密碼

    初次使用啟動(dòng)ES時(shí)會(huì)初始化用戶(hù)名:elastic,密碼是隨機(jī)生成的,在初次啟動(dòng)時(shí)控制臺(tái)會(huì)展示相關(guān)信息(包含初始化密碼),此時(shí)要注意保存,否則之后啟動(dòng)不會(huì)再顯示。 對(duì)于我而言,我初次啟動(dòng)時(shí)沒(méi)有保存記錄密碼,導(dǎo)致開(kāi)啟安全策略后無(wú)法通過(guò)用戶(hù)密碼登陸,并且我找了

    2024年02月10日
    瀏覽(32)
  • elasticsearch 7.6.1 的用戶(hù)名和密碼,kibana修改密碼

    elasticsearch 7.6.1 的用戶(hù)名和密碼,kibana修改密碼

    一/設(shè)置用戶(hù)名密碼 版本elasticsearch 7.6.1 elasticsearch/config/elasticsearch.yaml文件中添加如下內(nèi)容 # ---------------------------------- Auth ------------------------------------- xpack.security.enabled: true xpack.license.self_generated.type: basic xpack.security.transport.ssl.enabled: true 在elasticsearch bin目錄下使用如下命令

    2024年02月04日
    瀏覽(23)
  • Elasticsearch增加訪(fǎng)問(wèn)權(quán)限:使用用戶(hù)名和密碼訪(fǎng)問(wèn)

    Elasticsearch增加訪(fǎng)問(wèn)權(quán)限:使用用戶(hù)名和密碼訪(fǎng)問(wèn)

    elasticsearch服務(wù)安裝成功后,默認(rèn)可以在瀏覽器輸入地址直接訪(fǎng)問(wèn): 現(xiàn)對(duì)elasticsearch增加訪(fǎng)問(wèn)權(quán)限,使用用戶(hù)名和密碼訪(fǎng)問(wèn),操作步驟: 在elasticsearch安裝目錄的config文件下找到elasticsearch.yml配置文件,在文件末尾添加以下內(nèi)容 重新啟動(dòng)elasticsearch 切換到elasticsearch安裝目錄的b

    2024年02月03日
    瀏覽(30)
  • 使用URL訪(fǎng)問(wèn)elasticsearch攜帶用戶(hù)名和密碼

    使用URL訪(fǎng)問(wèn)elasticsearch攜帶用戶(hù)名和密碼

    示例: curl http://elastic:123456@127.0.0.1:9200/ 賬號(hào):elastic 密碼:123456 ?

    2024年02月16日
    瀏覽(22)
  • [Elasticsearch] 給ES設(shè)置必須以用戶(hù)名密碼訪(fǎng)問(wèn)

    [Elasticsearch] 給ES設(shè)置必須以用戶(hù)名密碼訪(fǎng)問(wèn)

    一、elasticsearch.yml中設(shè)置 1、進(jìn)入es的config目錄中打開(kāi)elasticsearch.yml 2、增加以下兩項(xiàng): 二、重啟es后使用elasticsearch-setup-passwords進(jìn)行密碼設(shè)置 1、在完成修改elasticsearch.yml后,重啟es; 2、進(jìn)入es的bin目錄,敲入命令: 3、之后分別給elastic, kibana, logstash_system,beats_system等用戶(hù)設(shè)置密

    2024年02月08日
    瀏覽(24)
  • k8s部署帶用戶(hù)名和密碼的elasticsearch

    k8s部署帶用戶(hù)名和密碼的elasticsearch

    elasticsearch本來(lái)可以不加用戶(hù)名和密碼,基于我們目前接觸越來(lái)越多的客戶(hù),為了數(shù)據(jù)的安全性,也需要遺憾的加上用戶(hù)名和密碼 下面是k8s部署的yaml 文件名稱(chēng):k8s-elasticsearch.yaml 執(zhí)行kubectl apply -f k8s-elasticsearch.yaml 然后進(jìn)入到es的pod中 命令: 進(jìn)入容器后 然后瀏覽器訪(fǎng)問(wèn) ip:30

    2024年02月11日
    瀏覽(20)
  • Elasticsearch(ES6)------(4) ES設(shè)置用戶(hù)名密碼訪(fǎng)問(wèn)

    Elasticsearch(ES6)------(4) ES設(shè)置用戶(hù)名密碼訪(fǎng)問(wèn)

    ?Elasticsearch(ES) ? ? ? ? ? ??(1) 下載、安裝+kibana 下載? ? ? ? ? ? ? ? ??(2) 本機(jī)多節(jié)點(diǎn)啟動(dòng)+ElasticSearch head插件使用? ? ? ? ? ? ??(3) 索引、文檔概念和索引CRUD ? ? ? ? ? ??(4) ES設(shè)置用戶(hù)名密碼訪(fǎng)問(wèn) ? ? ? ? ? ??(5)kibana的es查詢(xún)、mysql查詢(xún)轉(zhuǎn)換和對(duì)應(yīng)ja

    2024年02月09日
    瀏覽(23)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包