ceilometer获取数据暂时先不做解答,本篇注重websocket解决浏览器与openstack组件之间的实时状态更新。

大致流程如下:

nginx配置的反向代理如下:

/etc/nginx/nginx.conf

include /etc/nginx/conf.d/*.conf;

/etc/nginx/conf.d/openstack.conf

upstream websocket_beijing {
server 192.168.213.88:4500;
} server {
listen 81;
#server_name horizon.plcloud.com; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / {
include uwsgi_params;
uwsgi_pass unix:/var/run/uwsgi/openstack.sock;
}
location /static/{
alias /home/zzw/develop/horizon/static/;
}
} server {
listen 4600; location / {
proxy_pass http://websocket_beijing;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

日志说明:

/var/log/nginx/access.log #nginx访问日志

/var/log/nginx/error.log #nginx错误日志

uwsgi配置:

websocket.ini -> /home/zzw/develop/ceilometer/etc/ceilometer/websocket.ini

/etc/uwsgi/vassals/openstack.ini

# awcloud horizon uwsgi config file
[uwsgi] # Django-related settings
# the virtualenv (full path)
# home = /var/plcloud/horizon/.venv # the base directory (full path)
chdir = /home/zzw/develop/horizon/openstack_dashboard/wsgi
# Django's wsgi file
file = django.wsgi # maximum number of worker processes
processes = 4 # the socket (use the full path to be safe
socket = /var/run/uwsgi/%n.sock
# with appropriate permissions - may be needed
chmod-socket = 777
daemonize = /var/log/uwsgi/%n.log

日志说明:

/var/log/uwsgi/openstack.log

/var/log/uwsgi/websocket.log

redis配置订阅模式:

/etc/redis.conf

daemonize yes
pidfile /var/run/redis/redis.pid
port 6379
tcp-backlog 511
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis/
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

日志说明:

/var/log/redis/redis.log

ceilometer配置:

├── ceilometer.conf
├── ceilometertab.ini
├── matchmaker_ring.json
├── pipeline.yaml
├── policy.json
├── sources.json
└── templates
├── default.html
└── default.sms

日志说明:

├── agent-notification.log
├── alarm-evaluator.log
├── alarm-notifier.log
├── api.log
├── auditor.log
├── central.log
├── checker.log
├── collector.log
├── compute.log
├── websocket.log
└── zmq-receiver.log

配置过程报错集锦:

1. uwsgi缺少对openssl支持,/var/log/uwsgi/websocket.log 报错如下:

[pid: |app: |req: /] 192.168.216.48 () { vars in  bytes} [Thu Apr  :: ] GET /websocket?uid=33d5edff940f4812b5368e54499991e4&region=lab-test => generated  bytes in  msecs (HTTP/1.1 )  headers in  bytes ( switches on core )
you need to build uWSGI with SSL support to use the websocket handshake api function !!!

解决方法:重新编译uwsgi,支持openssl

cd uwsgi-2.0./
make
stop uwsgi
python setup.py install
start uwsgi

websocket数据流解析的更多相关文章

  1. WebSocket协议解析

    WebSocket协议解析 转载请注明出处:WebSocket解析 现在,很多网站为了实现推送技术,所用的技术都是轮询.轮询是指在特定的时间间隔(如每一秒),由浏览器对服务器发起HTTP请求,然后由服 ...

  2. iOS swift项目IM实现,从长连接到数据流解析分析之Socket

    iOS  swift项目IM实现,从长连接到底层数据解析分析之Socket 一:项目简介:  去年开始接手了一个国企移动项目,项目的需求是实现IM即时通讯功能. * 一期版本功能包括了:       ...

  3. Websocket 协议解析

    WebSocket protocol 是HTML5一种新的协议.它是实现了浏览器与服务器全双工通信(full-duplex).          现 很多网站为了实现即时通讯,所用的技术都是轮询(po ...

  4. 萌萌的websocket原理解析

    转载自:http://www.zhihu.com/question/20215561 一.WebSocket是HTML5出的东西(协议),也就是说HTTP协议没有变化,或者说没关系,但HTTP是不支持 ...

  5. 转载-WebSocket协议解析

    现在,很多网站为了实现推送技术,所用的技术都是轮询.轮询是指在特定的时间间隔(如每一秒),由浏览器对服务器发起HTTP请求,然后由服务器返回数据给浏览器.由于HTTP协议是惰性的,只有客户端发起请求, ...

  6. springMVC中数据流解析与装载

    最近在看springmvc原理时,看到一篇比较赞的博文,留存学习,如果侵权,请告知,立删. 地址: https://my.oschina.net/lichhao/blog/172562

  7. pdf 数据流解析

     根据这个解释可以认为,/CCITTFaxDecode应该指单色图像(每个像素占8位?还是1位),FlateDecode 指文字或者矢量图片(png) 参考论文:http://www.doc88.co ...

  8. 通讯框架 t-io 学习——websocket 部分源码解析

    前言 前端时间看了看t-io的websocket部分源码,于是抽时间看了看websocket的握手和他的通讯机制.本篇只是简单记录一下websocket握手部分. WebSocket握手 好多人都用过 ...

  9. WebSocket解析

    WebSocket解析 转载请注明出处:WebSocket解析 现在,很多网站为了实现推送技术,所用的技术都是轮询.轮询是指在特定的时间间隔(如每一秒),由浏览器对服务器发起HTTP请求,然后由服务器 ...

随机推荐

  1. Android ViewStub的使用方法

    大家写项目的时候肯定会有一些东西提前写好,可是不到一定条件是不想让它显示出来的.我们可能的做法就是让它View.GONE 或View.INVISIBLE等到一定条件了在代码里面这设置View.VISI ...

  2. java project打包生成jar包(通用)

    1. 在工程目录下新建一个build.xml文件,如下图所示,注意必须是在工程目录下,而不是在工程目录的src目录里. 2.编写ant脚本,内容如下,jar文件名称(com.anllin.rup.bo ...

  3. [Python爬虫] 之二十二:Selenium +phantomjs 利用 pyquery抓取界面网站数据

    一.介绍 本例子用Selenium +phantomjs爬取界面(https://a.jiemian.com/index.php?m=search&a=index&type=news& ...

  4. pl/sql游标

    通过游标,我们可以取得返回结果集的任何一行记录,提高效率. 定义游标: type 游标名 is ref cursor 变量名 游标名 打开游标: open 游标变量 for select语句: 取出当 ...

  5. iOS小技巧 - 如何生成范围随机数

    生成[0, N-1]的随机数 NSUInteger r = arc4random_uniform(N); 生成[1, N]的随机数 NSUInteger r = arc4random_uniform( ...

  6. [GraphQL] Filter Data Based on Query Arguments with GraphQL

    With GraphQL, every field and nested object can have a set of arguments which can be used to request ...

  7. mac 上多版本python 共存

    Mac上自带了Python2.x的版本,有时需要使用Python3.x版本做开发,但不能删了Python2.x,可能引起系统不稳定,那么就需要安装多个版本的Python. 1.安装Python3.x版 ...

  8. 原生 javascript 基础回顾

    (1)打开新窗口 语法: window.open([URL], [窗口名称], [参数字符串]) 参数说明: URL:可选参数,在窗口中要显示网页的网址或路径.如果省略这个参数,或者它的值是空 字符串 ...

  9. Activity设置切换动画时黑屏问题的解决

    //当这么设置的时候.打开Acticity的时候会黑屏一下 overridePendingTransition(R.anim.activity_open,0); //改成例如以下代码 完美解决这个问题 ...

  10. 《windows核心编程》- 线程栈

    当系统创建线程的时候,会为线程栈预订一块地址空间区域,并给该区域调拨一些物理存储器.默认会预订1MB的地址空间并调拨两个页面的存储器.但是在构建 应用程序的时候可以改变这个默认值 在构建应用程序的时候 ...