Apache Knox代理各个服务组件的UI

参考链接:
https://blog.csdn.net/qq_37865420/article/details/105787160
https://zhuanlan.zhihu.com/p/426251773

一、knox的安装部署

1.解压缩

unzip knox-{
   VERSION}.zip

2.启动嵌入的LDAP

cd {
   GATEWAY_HOME}

bin/ldap.sh start

3.创建Master 密钥

cd {
   GATEWAY_HOME}

bin/knoxcli.sh create-master --master 123456

4.启动和关闭konx

cd {
   GATEWAY_HOME}

bin/gateway.sh start

bin/gateway.sh stop

如果由于某种原因使网关停止运行(而不是使用上述命令),导致knox启动不起来,则可能需要清除跟踪PID:

cd {
   GATEWAY_HOME}
bin/gateway.sh clean
注:此命令同时也会清除所有.out与.err从文件{
   GATEWAY_HOME}/logs目录,以便使用该谨慎。

5.访问Knox webui

https://192.x.x.x:8443/gateway/manager/admin-ui/
		
自带ldap默认用户密码
admin/admin-passwrod
guest/guest-passwrod

二通过knox访问各个服务组件

1.添加白名单

修改knox/conf/gateway-site.xml:
需要将Knox用到的主机和Ip加入到白名单中
<property>
        <name>gateway.dispatch.whitelist</name>
        <value>^https?:\/\/(henghe-039|henghe-040|localhost|127\.0\.0\.1|0:0:0:0:0:0:0:1|::1):[0-9].*$</value>
        <description>The whitelist to be applied for dispatches associated with the service roles specified by gateway.dispatch.whitelist.services.
        If the value is DEFAULT, a domain-based whitelist will be derived from the Knox host.</description>
    </property>

白名单正则,代表全部主机
<name>gateway.dispatch.whitelist</name>
<value>^.*$</value>

修改完需要重启服务,才会生效

knox/conf/topologies/sandbox.xml: 支持的服务UI,热部署,更改不需要重启就会生效

2.所有服务的knox的配置

修改knox/conf/topologies/sandbox.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<topology>

    <gateway>

        <provider>
            <role>authentication</role>
            <name>ShiroProvider</name>
            <enabled>true</enabled>
            <param>
                <!-- 
                session timeout in minutes,  this is really idle timeout,
                defaults to 30mins, if the property value is not defined,, 
                current client authentication would expire if client idles contiuosly for more than this value
                -->
                <name>sessionTimeout</name>
                <value>30</value>
            </param>
            <param
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

这个操蛋的人生!!!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值