2017-09-18 166 views
1

我試圖找出keycloak版本3.3.0.CR1中的導入/導出最佳做法。正如我在keycloak官方網頁上看到的那樣,被描述爲他們的策略。在這裏他們的例子是導出到單個文件json。 Goint to/keycloak/bin文件夾並運行此:Kubernetes中導出/導入Keycloak數據的最佳做法

./standalone.sh -Dkeycloak.migration.action=export -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=keycloak-export.json 

我登錄到k8s pod。運行該命令後,我得到的錯誤:

12:23:32,045 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([ 
    ("core-service" => "management"), 
    ("management-interface" => "http-interface") 
]) - failure description: { 
    "WFLYCTL0080: Failed services" => {"org.wildfly.management.http.extensible" => "java.net.BindException: Address already in use /127.0.0.1:9990"}, 
    "WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => { 
     "Services that were unable to start:" => ["org.wildfly.management.http.extensible.shutdown"], 
     "Services that may be the cause:" => ["jboss.remoting.remotingConnectorInfoService.http-remoting-connector"] 
    } 
} 

依我之見,因爲在那裏,我跑備份腳本在同一端口上Keycloak服務器運行。 Here helm/keycloak values.yml:

Service: 
    Name: keycloak 
    Port: 8080 
    Type: ClusterIP 

Deployment: 
    Image: jboss/keycloak 
    ImageTag: 2.5.1.Final 
    ImagePullPolicy: IfNotPresent 
    ContainerPort: 8080 
    KeycloakUser: Admin 
    KeycloakPassword: Admin 

因此,在我們運行這些腳本之前應該停止服務器?我無法停止吊艙內的keycloak進程,因爲入口將關閉吊艙並將創建新的吊艙。 任何其他方式的導出/導入(備份/恢復)數據的建議?或者我錯過了什麼?

P.S. 我甚至嘗試過UI導入/導出。出口工作很好,我看到所有的數據。但進口工作的一半。他帶給我所有的「客戶」,但不是我的「領域」和「用戶聯合會」。可能嗎?

回答

3

基本上,您只需在與主實例不同的端口上啓動導出Keycloak實例。我用這樣的事情剛纔:

bin/standalone.sh -Dkeycloak.migration.action=export -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=keycloak-export.json -Djboss.http.port=8888 -Djboss.https.port=9999 -Djboss.management.http.port=7777

的重要組成部分,是所有端口。如果你得到更多的錯誤信息,則可能需要添加更多的屬性(grep port standalone/configuration/standalone.xml是你的朋友找出屬性名稱),但最終,所有的錯誤信息停止和你看到這條消息,而不是:

09:15:26,550 INFO [org.keycloak.exportimport.singlefile.SingleFileExportProvider] (ServerService Thread Pool -- 52) Exporting model into file /opt/jboss/keycloak/keycloak-export.json [...] 09:15:29,565 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 3.2.0.Final (WildFly Core 2.0.10.Final) started in 12156ms - Started 444 of 818 services (558 services are lazy, passive or on-demand)

現在您可以使用Ctrl - C停止服務器,退出容器並使用kubectl cp複製導出文件。

相關問題