Install
发行版支持矩阵参考这里。
ubuntu cloud 18.04
MapR
1 | wget https://package.mapr.com/releases/installer/mapr-setup.sh -P /tmp |
登录
访问 https://<ip>:9443
,注意是 https,chrome 不能访问的话换个浏览器。
spring 提供了缓存功能,接下来完成一个示例,然后看下怎么不缓存空结果以及怎么写单测。
1 | <dependency> |
1 | ├── cache |
1 | package pub.wii.cook.springboot.cache; |
1 | package pub.wii.cook.springboot.cache; |
1 | package pub.wii.cook.springboot.cache; |
1 | package pub.wii.cook.springboot.controller; |
1 | curl "http://localhost:8080/cache/get?key=wii" |
只需要在 @Cacheable
添加 unless = "#result == null or #result.size() == 0"
选项即可。
1 |
|
相较于其他单测方式,直接测 Cache 内有没有缓存数据更直接。
1 | package pub.wii.cook.springboot.cache; |
1 | package pub.wii.cook.springboot.config; |
官网给了丰富的安装方式。
添加仓库
1 | sudo vim /etc/yum.repos.d/elasticsearch.repo |
安装
1 | sudo yum install --enablerepo=elasticsearch elasticsearch |
systemd 配置
1 | sudo systemctl daemon-reload |
启动
1 | sudo systemctl start elasticsearch.service |
文档参考这里。
对于使用 yum 在 centos 7 安装的 es 来说,可执行程序在
/usr/share/elasticsearch/bin
下。
1 | 命令格式 |
角色 内置角色在这里。
superuser
: 管理员,所有权限
1 | install public signing key |
1 | sudo systemctl start kibana.service |
1 | # file: /etc/kibana/kibana.yml |
在 Kibana 首页,打开 Dev Tools,或者直接访问 http://host:5601/app/dev_tools#/console
。
左侧为请求,右侧为响应。
请求的第一行,为请求方法及 URL,下方为数据。
1 | GET index_article/_search |
1 | -X 指定请求方法 |
1 | 格式 |
etcd 旨在可靠地存储不常更新的数据,并提供可靠的监控查询。
1 | 对于 gz 格式日志文件,使用 gzcat |
使用 brew 或下载。
1 | brew install goaccess |
nginx 日志格式配置需要转换为 goaccess 可识别的日志格式,下面是示例。
nginx 配置 | goaccess 格式配置 |
---|---|
$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" "$request_body" "$upstream_addr" $upstream_status $upstream_response_time $request_time |
log-format %h %^ [%d:%t %^] "%r" %s %b "%R" "%u" "%^" "%^" "%^" %^ %^ %T date-format %d/%b/%Y time-format %T |
$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_addr $upstream_response_time $pipe |
%h %^[%d:%t %^] "%r" %s %b "%R" "%u" %T %^ |
分析前,需要配置日志格式。日志格式可以在 ~/.goaccessrc
文件配置,也可以在命令行中指定。
1 | ~/.goaccessrc |
1 | 使用 ~/.goaccessrc 文件配置日志格式 |
如果出错,可以尝试去掉
LANG="en_US.UTF-8"
1 | <plugin> |
assemble.xml
1 | <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" |
网络类型设置主要参考两篇文章,设置网络硬件接口 provider 和 设置自服务虚拟网络。
openstack 配置的是 self-service 网络模式,外网是指虚拟网络外的网络,这里是路由器的网络 192.168.6.1/24
。
这里以 ubuntu 20.04 为例,物理机有两个网口(enp4s0、enp5s0)。
1 | /etc/netplan/99-config.xml |
这里是把 enp5s0 网口设置为固定 ip,关闭 enp4s0 的 dhcp 且不分配 ip。
neutron 的配置要关注 /etc/neutron/plugins/ml2
的内容。
1 | cat ml2_conf.ini | grep -v '#' | grep '\S' |
在 linuxbridge_agent.ini
配置的 physical_interface_mappings = provider:enp4s0
中的 provider:enp4s0
,冒号前面是新增的接口名称,enp4s0 为系统显示的硬件网络接口。
在 ml2_conf.ini
中配置 flat_networks = provider
,指定 flat 类型接口使用的网络接口。
设置多值
physical_interface_mappings = provider:enp4s0,providervpn:enp5s0
flat_networks = provider,providervpn
编辑 /etc/sysctl.conf
,设置 net.ipv4.ip_forward=1
。
注意
- 创建外部网络用 FLAT 类型,物理网络填 provider(和 linuxbridge_agent.ini 中配置的一致)
- 创建内部网络用 VXLAN 类型
首先,要在管理员下创建外部网络。
连接外网有两种方式,一种是实例直连新建的外部网络,一种是创建内部网络,内部网络通过路由连接外部网络。
网络拓扑图中,test 主机是直连外部网络,可以分配 192.168.6.* 地址,以及访问外网,data 和 work 连接内部网络(10.1.0.0/24),然后内部网络通过路由连接外部网络。
分配外部网络地址有两种方式,直连外部网络和 floating ip。
直连外部网络是给实例添加接口,并指定网络为外部网络,这样在实例里面查看网络信息可以查看到分配的外网 ip。使用 floating ip 的话,将 floating ip 实例分配的内网 ip 绑定,实例内并不能看到 floating ip,外部可以通过 floating ip 访问实例。
openstack 默认的安全组禁止所有请求访问,需要添加入口权限。