Kong的安装和使用-
参考:https://www.west.cn/info/html/caozuoxitong/Linux/20180929/4594245.html 1 openssl和pcre一般系统自带:yum -y install pcre-devel openssl openssl-devel openssl升级: wget https://www.openssl.org/source/openssl-1.1.0 tar -xvf openssl-1.1.1b.tar.gz ./config shared zlib ln -s /usr/local/openssl-1.1.0/bin/openssl /usr/bin/openssl ln -s /usr/local/openssl-1.1.0/bin/openssl /usr/bin/openssl echo "/usr/local/openssl-1.1.0/lib" >> /etc/ld.so.conf ln -s /usr/local/openssl-1.1.0/lib/libcrypto.so.1.0 /usr/lib64/libcrypto.so.1.0 ln -s /usr/local/openssl-1.1.0/lib/libssl.so.1.0 /usr/lib64/libssl.so.1.0 ldconfig -v openssl version -a 2 yum install git -y 3 yum install gcc -y 4 lua 安装 wget http://www.lua.org/ftp/lua-5.3.4.tar.gz yum install libtermcap-devel ncurses-devel libevent-devel readline-devel -y tar -xzf lua-5.3.4.tar.gz cd lua-5.3.4 make linux test 5 安装LuaJIT wget http://luajit.org/download/LuaJIT-2.0.5.tar.gz tar -xvf LuaJIT-2.0.5.tar.gz make -j8 make install 5 下载openrest并编辑安装 openrest安装前需要安装一个补丁:https://github.com/Kong/openresty-patches ./configure --prefix=/usr/local/openresty --with-pcre-jit --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --with-http_v2_module --with-openssl=/data/soft/openssl-1.1.1b gmake gmake install 6 安装lua包管理工具包-luarocks git clone https://github.com/luarocks/luarocks.git ./configure make && make install 7.安装kong git clone git@github.com:Kong/kong.git cd kong make install 拷贝kong的配置文件:sudo cp kong.conf.default /etc/kong/kong.conf 8 安装jdk 9 安装 -cassandra https://www.cnblogs.com/zzd-zxj/p/6061378.html 1)下载 wget http://mirrors.cnnic.cn/apache/cassandra/2.1.14/apache-cassandra-2.1.14-src.tar.gz tar -zxvf apache-cassandra-2.1.14-bin.tar.gz -C /opt/cassandra 2)创建目录 1 //可以根据磁盘情况设置这3个文件夹,但是要和cassandra.yaml里的想对应 2 mkdir /var/lib/cassandra/data 3 mkdir /var/lib/cassandra/commitlog 4 mkdir /var/lib/cassandra/saved_caches 3)修改配置文件 cluster_name: 'xxx' //集群名称。同一个集群要使用同一名称 data_file_directories: - /var/lib/cassandra/data //数据文件存放路径。打开这个注释,注意不要合并成一行,合并成一行好像会出问题,这里要与前面新建的文件夹对应。 commitlog_directory: /var/lib/cassandra/commitlog //操作日志文件存放路径。打开注释,与前面新建的文件夹对应。 saved_caches_directory: /var/lib/cassandra/saved_caches //缓存文件存放路径。打开注释,与前面新建的文件夹对应。 - seeds: "192.168.x.x" //集群种子节点ip,新加入集群的节点从种子节点中同步数据。可配置多个,中间用逗号隔开。 listen_address: 127.0.0.1 //需要监听的IP或主机名。改成本机IP rpc_address: 127.0.0.1 //用于监听客户端连接的地址。建议设置成IP或0.0.0.0。若设置0.0.0.0,则要放开broadcast_rpc_address: 1.2.3.4的注释。 4)启动项目 ./cassandra -R //用root用户启动 关闭,直接调用kill 5)查看服务器状态 ./nodetool status 10 cassandra基本操作 1)场景:是一款分布式的结构化数据存储方案(NoSql数据库),存储结构比Key-Value数据库(像Redis)更丰富,但是比Document数据库(如Mongodb)支持度有限;适合做数据分析或数据仓库这类需要迅速查找且数据量大的应用 2)概念:keyspace -> table –> column,对应关系型数据库 database -> table -> column 3)配置说明-cassandra.yaml可以完成cassandra的大部分配置 1、Main runtime properties(主要的cassandra运行时属性) a) cluster_name:集群名,同一集群的多个节点,集群名要一致 b) seeds: 种子节点,集群中的全部机器的ip,以逗号隔开 c) storage_port: Cassandra服务器与服务器之间连接的端口号,一般不需要修改,但要保证此端口上没有防火墙 d) listen_address: Cassandra集群中服务器与服务器之间相互通信的地址。如果留空,将默认使用服务器的机器名 e) native_transport_port: 默认的CQL本地服务端口,本地的cql客户端与服务器交互的端口 2、Changing the location of directories(相关的文件目录) a) data_file_directories: 数据文件存放的目录,一个或多个 b) commitlog_directory: 提交信息的日志文件存放的目录 c) saved_caches_directory: 缓存存放的目录 4)cassandra基本操作 - 启动客户端 ./bin/cqlsh 1、查询全部的keyspace:describe keyspaces;(或desc keyspaces;) 2、创建一个keyspace:CREATE KEYSPACE IF NOT EXISTS myCas WITH REPLICATION = {'class': 'SimpleStrategy','replication_factor':1}; class : 副本配置策略(总共有三种): Simple Strategy(RackUnaware Strategy):副本不考虑机架的因素,按照Token放置在连续下几个节点。如下图所示,假如副本数为3,属于A节点的数据在B.C两个节点中也放置副本 OldNetwork Topology Strategy(RackAware Strategy):考虑机架的因素,除了基本的数据外,先找一个处于不同数据中心的点放置一个副本,其余N-2个副本放置在同一数据中心的不同机架中 Network Topology Strategy(DatacneterShard Strategy):将M个副本放置到其他的数据中心,将N-M-1的副本放置在同一数据中心的不同机架中 3、使用某个keyspace:use myCas; 4、查询全部的table:desc tables; 5、创建一张表:CREATE TABLE user (id int, user_name varchar, PRIMARY KEY (id) ); 创建表的时候至少指定一个主键 6、向表中插入一条记录:INSERT INTO user (id,user_name) VALUES (1,'zhangsan'); 列名必须要显示指定,如果表中已存在相同主键的记录,那么该操作会覆盖表中已存在的记录 7、查询表中全部数据:select * from user; cassandra查询有很多限制,比如只能单表查询,不支持联表查询和子查询,查询条件只支持key查询和索引列查询,而且key有顺序的限制,等等;更多详情请自行阅读官方文档 8、简单的条件查询:select * from user where id=1; 9、创建索引:create index on user(user_name); 10、索引列查询:select * from user where user_name='zhangsan'; 若没有在name上创建索引,那么此查询会报错; 11、更新表中数据:update user set user_name='lisi' where id=2; 只支持按主键更新,也就是where后只能跟主键 12、删除表中记录:delete from user where id=1; 删除某条记录中的某个字段,该字段会被设成null:delete user_name from user where id=1; 无论是删除某条记录,还是将某个字段置null,都只支持按主键删除,也就是where后只能跟主键 5)登录认证 1、修改配置文件cassandra.yaml 把默认的authenticator: AllowAllAuthenticator运行所有人登录设置为用密码登录:authenticator: PasswordAuthenticator 2、登录cassandra,然后创建新的用户 配置文件修改完后,启动cassandra(如若双击cassandra.bat启动报错,可以试着在cmd中启动cassandra);接着启动客户端: cqlsh.bat -ucassandra -pcassandra; cassandra用户是默认的,客户端启动成功后,创建新的用户:create user admin with password 'admin' superuser; 新用户创建成功后,退出客户端:exit; 用新用户登录:cqlsh.bat -uadmin –padmin; 删除默认用户cassandra:drop user cassandra; 记得把默认用户删除掉;另外,可以到system_auth下的roles表中查看已有用户; 10、创建数据库 1)ALTER KEYSPACE kong WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 } ; 备份数量为1 ./kong migrations up luarocks remove luaossl --force luarocks install luaossl ./kong migrations bootstrap -v ./kong migrations up -v lua 版本需要降级 11 插件-位置 配置文件/etc/kong/kong.conf 最后的位置,有kong源码的目录,目录中有plugins就是插件的位置 每次修改后重启一下 create user kong with password 'admin' superuser ALTER KEYSPACE kong WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 } oauth2_tokens response_ratelimiting_metrics oauth2_credentials locks acls certificates snis cluster_ca services plugins cluster_events oauth2_authorization_codes targets jwt_secrets routes consumers apis hmacauth_credentials upstreams basicauth_credentials
相关推荐
centos的kong安装文件
Kong构建工具 生成,打包和发布Kong所需的工具 先决条件 Kong源 码头工人 码头工人组成 制作 所有示例均假定Kong是kong-build-tools的同级目录,并且除非另有说明,否则从kong-build-tools目录运行。 可以通过设置...
CentOS 7.1 离线安装API -kong所需依赖包
kong老版本网关安装文件
离线安装kong-admin, kong使用pgsql, kong-admin初始化pgsql用db文件,对应数据库名为 kong ... 记住,这里是kong-admin,不是kong
讲述kong API网关的集群配置安装部署与运行,并通过实例验证
主要介绍了docker安装kong网关的方法示例,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
安装 npm i @payfun/node-kong 如何使用? Step1配置Kong选项 例子 const KongOption = { KongHOST : '<Kong>' , service : { name : '<Service>' , protocol : 'http' , port : 80 , connect_timeout : ...
Kong与Docker-Compose 一个如何在Docker compose中使用Kong的示例。 此示例中有4种服务: kong :API网关 kong-migration :自我终止的容器,用于仅迁移Kong的数据库。 kong-database :Postgres数据库(Kong...
该目录已安装到postgres容器中(请参阅docker-compose.yml) 承诺使用此目录以确保docker-compose不会因缺少目录而失败。ProtoBuf 去做工具去做入门建筑$ docker build -t kong:latest跑步$ docker-compose up kong
kong-2.0.2.el7.amd64 在官网的https://docs.konghq.com/install/centos/ 下载比较慢的时候,可以现在这个版本。
基于centos 7.0,6.5 等安装测试,带网管配置界面,根据用户角色授权等。
安装版本 Kong 2.0.4-高山 Kong加0.14.7 钥匙斗篷10.0.2 本教程的目标 本教程的目标是能够通过kong和keycloak的配置来保护API资源。 更详细地,让我们考虑以下请求流程: 用户应用程序将请求发送到API网关(kong)...
要使用Composer安装kong-php,只需将以下内容添加到composer.json文件中: { " require-dev " : { " therealgambo/kong-php " : " 0.10.* " } } 或通过运行以下命令: composer require therealgambo/kong-php ...
1、docker安装kong,konga 2、Kong 基础认证插件(Basic auth) 3、Kong的插件: Key Authentication 4、Kong插件[IP Restriction]使用【黑白名单】 5、kong网关
资源分类:Python库 所属语言:Python 资源全名:pulumi_kong-2.1.3.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
安装 > npm install -g kong-portal-cli用法最简单的开始方法是在本地克隆主分支。 然后编辑workspaces/default/cli.conf.yaml以设置kong_admin_uri和kong_admin_token以匹配您的设置。 确保 Kong 正在运行并且门户...
安装httpd服务器 设置/转到[回购主目录] / app 配置/ bower_components转到[repo home] / bower_components 将/ admin配置为proxy_pass到您的香港服务器 将[repo home] /app/settings.js.example复制到settings.js...
安装方法:https://blog.csdn.net/qq_14999375/article/details/129228919 kong&konga完整安装包,包含文件: - kong - konga(已编译) - postgreSQL12.2 - node14
支持的功能添加API 每个API添加插件在根目录中添加插件(适用于所有API)路线图实施所有Kong Admin API 增加UT覆盖安装这是可通过使用的模块。 使用完成 : $ npm install kong-admin-client --save用法 let KongAPI...