2017-09-18 165 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复制导出文件。

相关问题