oVirt Reports Portal 3.4 added to ovirt-engine

本文涉及的产品
云原生数据库 PolarDB MySQL 版,通用型 2核4GB 50GB
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
简介:
配置完oVirt engine后, 可以进行用户管理和虚拟化平台的管理, 但是无法生成报告.
如图, 点击Reports Portal会告诉你没有安装report application.
oVirt Reports Portal 3.4 - 德哥@Digoal - PostgreSQL research

安装ovirt engine可参考昨天发的一篇文章.
engine report建议在engine配置前就安装, 那么只需engine-setup时可以直接配置.
现在的话, 等于已经配置了engine, 再加一个engine report的功能.
步骤如下 :
# yum install -y ovirt-engine-reports

Installing:
 ovirt-engine-reports                    noarch              3.4.3-1.el6                        ovirt-3.4-stable              1.1 M
Installing for dependencies:
 jasperreports-server                    noarch              5.5.0-7.el6                        ovirt-3.4-stable              423 M
 liberation-mono-fonts                   noarch              1.05.1.20090721-5.el6              C6.3-base                     222 k
 ovirt-engine-dwh-setup                  noarch              3.4.3-1.el6                        ovirt-3.4-stable               51 k
 ovirt-engine-reports-setup              noarch              3.4.3-1.el6                        ovirt-3.4-stable               54 k

安装时可能遇到GPGCHECK的问题, 加这个参数处理 --nogpgcheck.
Package ovirt-engine-dwh-setup-3.4.3-1.el6.noarch.rpm is not signed

yum install --nogpgcheck -y ovirt-engine-reports

然后执行engine-setup配置.
[root@db-172-16-3-150 ~]# engine-setup --help
Usage: /usr/bin/engine-setup
    --log=file
        write log to this file.
    --config=file
        Load configuration files.
    --config-append=file
        Load extra configuration files or answer file.
    --offline
        Offline mode.
    --generate-answer=file
        Generate answer file.
    --jboss-home=dir
        Use this jboss.

使用engine-setup过程中, 需要调用pg_dump备份数据库, 这个命令会调用/usr/bin/pg_dump, 而且尝试了几种办法没有办法修改为其他路径下的pg_dump(因为备份和服务端的版本不匹配会导致pg_dump失败).  (见末尾)
所以使用了一个方法, 直接覆盖.
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/pg_dump /usr/bin
cp: overwrite `/usr/bin/pg_dump'? y 
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/pg_restore /usr/bin
cp: overwrite `/usr/bin/pg_restore'? y
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/psql /usr/bin
cp: overwrite `/usr/bin/psql'? y

还需要修改数据库用户的权限, 备份时开启了read only事务, 必须超级用户. 
2014-07-29 22:28:18 DEBUG otopi.plugins.**FILTERED**_engine_setup.**FILTERED**_engine.db.schema plugin.execute:866 execute-output: ('/usr/bin/pg_dump', '-E', 'UTF8', '--disable-dollar-quoting', '--disable-triggers', '--format=c', '-U', '**FILTERED**', '-h', 'localhost', '-p', '5432', '-f', '/var/lib/**FILTERED**-engine/backups/engine-20140729222818.Rbikl1.dump', '**FILTERED**') stderr:
pg_dump: [archiver (db)] query failed: ERROR:  permission denied to set parameter "transaction_read_only"
pg_dump: [archiver (db)] query was: SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY

修改为超级用户.
postgres=# alter role ovirt superuser;
ALTER ROLE


安装ovirt-report需要用到两个数据库, 一个历史库, 一个报告库.
需要新建. 用户使用ovirt同一个用户, 不一样也行, 无所谓.
# cd /ssd4/pg93
# mkdir tbs_ovirt_eh
# chown pg93:pg93 tbs_ovirt_eh

[root@db-172-16-3-150 pg93]# su - pg93
pg93@db-172-16-3-150-> psql
psql (9.3.3)
Type "help" for help.

digoal=# create tablespace tbs_ovirt_eh location '/ssd4/pg93/tbs_ovirt_eh';
CREATE TABLESPACE
digoal=# create database ovirt_eh with template template0 encoding 'UTF8' tablespace tbs_ovirt_eh owner ovirt;
CREATE DATABASE
digoal=# \c ovirt_eh ovirt
You are now connected to database "ovirt_eh" as user "ovirt".
-- ovirt_eh=> create schema ovirt;  -- 不推荐自建schema, 建议使用public. 和ovirt engine原因一样 .
-- CREATE SCHEMA

pg93@db-172-16-3-150-> mkdir /ssd4/pg93/tbs_ovirt_er
pg93@db-172-16-3-150-> psql
psql (9.3.3)
Type "help" for help.

digoal=# create tablespace tbs_ovirt_er location '/ssd4/pg93/tbs_ovirt_er';
CREATE TABLESPACE
digoal=# create database ovirt_er with template template0 encoding 'UTF8' tablespace tbs_ovirt_er owner ovirt;
CREATE DATABASE
digoal=# \c ovirt_er ovirt
You are now connected to database "ovirt_er" as user "ovirt".
-- ovirt_er=> create schema ovirt;   -- 不推荐自建schema, 建议使用public. 和ovirt engine原因一样 .
-- CREATE SCHEMA
ovirt_er=> \c postgres postgres
You are now connected to database "postgres" as user "postgres".
postgres=# grant all on tablespace tbs_ovirt_eh to ovirt;
GRANT
postgres=# grant all on tablespace tbs_ovirt_er to ovirt;
GRANT
postgres=# \q


现在还不能执行engine-setup, 务必改一下yum, 因为某些依赖包可能需要签名认证, 如果没有签名会导致认证失败.
不推荐这么做, 建议导入KEY.
关闭检测.
vi /etc/yum.repos.d/ovirt-3.4-dependencies.repo
vi /etc/yum.repos.d/ovirt-3.4.repo
修改所有的 gpgcheck=0.

可以执行engine-setup了, 执行过程中会重启ovirt-engine服务, 不过不会影响host上跑的虚拟机, 所以可以放心在线配置.
[root@db-172-16-3-150 ~]# engine-setup
[ INFO  ] Stage: Initializing
[ INFO  ] Stage: Environment setup
          Configuration files: ['/etc/ovirt-engine-setup.conf.d/10-packaging.conf', '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf']
          Log file: /var/log/ovirt-engine/setup/ovirt-engine-setup-20140729223458-tzk701.log
          Version: otopi-1.2.2 (otopi-1.2.2-1.el6)
[ INFO  ] Stage: Environment packages setup
[ INFO  ] Yum Downloading: ovirt-3.4-epel/metalink (0%)
[ INFO  ] Yum Downloading: repomdydzDTUtmp.xml (0%)
[ INFO  ] Yum Downloading: repomd3tKhg7tmp.xml (0%)
[ INFO  ] Yum Downloading: repomdcWBV6Ttmp.xml (0%)
[ INFO  ] Stage: Programs detection
[ INFO  ] Stage: Environment setup
[ INFO  ] Stage: Environment customization
         
          --== PRODUCT OPTIONS ==--
         
          Configure Reports on this host (Yes, No) [Yes]: 
          Configure Data Warehouse on this host (Yes, No) [Yes]: 
         
          --== PACKAGES ==--
         
[ INFO  ] Checking for product updates...
[ INFO  ] No product updates found
         
          --== NETWORK CONFIGURATION ==--
         
          Setup can automatically configure the firewall on this system.
          Note: automatic configuration of the firewall may overwrite current settings.
          Do you want Setup to configure the firewall? (Yes, No) [Yes]: No
         
          --== DATABASE CONFIGURATION ==--
         
          Where is the DWH database located? (Local, Remote) [Local]: 
          Setup can configure the local postgresql server automatically for the DWH to run. This may conflict with existing applications.
          Would you like Setup to automatically configure postgresql and create DWH database, or prefer to perform that manually? (Automatic, Manual) [Automatic]: Manual
         
          ATTENTION
         
          Manual action required.
          Please create database for ovirt-engine use. Use the following commands as an example:
         
          create role ovirt_engine_history with login encrypted password 'ovirt_engine_history';
          create database ovirt_engine_history owner ovirt_engine_history
           template template0
           encoding 'UTF8' lc_collate 'en_US.UTF-8'
           lc_ctype 'en_US.UTF-8';
         
          Make sure that database can be accessed remotely.
         
          DWH database secured connection (Yes, No) [No]: 
          DWH database name [ovirt_engine_history]: ovirt_eh
          DWH database user [ovirt_engine_history]: ovirt
          DWH database password: 
          Where is the Reports database located? (Local, Remote) [Local]: 
          Setup can configure the local postgresql server automatically for the Reports to run. This may conflict with existing applications.
          Would you like Setup to automatically configure postgresql and create Reports database, or prefer to perform that manually? (Automatic, Manual) [Automatic]: Manual
         
          ATTENTION
         
          Manual action required.
          Please create database for ovirt-engine use. Use the following commands as an example:
         
          create role ovirt_engine_reports with login encrypted password 'ovirt_engine_reports';
          create database ovirt_engine_reports owner ovirt_engine_reports
           template template0
           encoding 'UTF8' lc_collate 'en_US.UTF-8'
           lc_ctype 'en_US.UTF-8';
         
          Make sure that database can be accessed remotely.
         
          Reports database secured connection (Yes, No) [No]: 
          Reports database name [ovirt_engine_reports]: ovirt_er
          Reports database user [ovirt_engine_reports]: ovirt
          Reports database password: 
         
          --== OVIRT ENGINE CONFIGURATION ==--
         
          Skipping storing options as database already prepared
         
          --== PKI CONFIGURATION ==--
         
          PKI is already configured
         
          --== APACHE CONFIGURATION ==--
         
         
          --== SYSTEM CONFIGURATION ==--
         
         
          --== MISC CONFIGURATION ==--
         
          Reports power users password: 输入engien123
          Confirm Reports power users password: 输入engien123
         
          --== END OF CONFIGURATION ==--
         
[ INFO  ] Stage: Setup validation
[ INFO  ] Cleaning stale zombie tasks
         
          --== CONFIGURATION PREVIEW ==--
         
          Engine database name                    : ovirt
          Engine database secured connection      : False
          Engine database host                    : localhost
          Engine database user name               : ovirt
          Engine database host name validation    : False
          Engine database port                    : 5432
          Update Firewall                         : False
          Configure WebSocket Proxy               : False
          Host FQDN                               : db-172-16-3-150.sky-mobi.com
          NFS mount point                         : /ssd4/ovirt/iso
          DWH installation                        : True
          DWH database name                       : ovirt_eh
          DWH database secured connection         : False
          DWH database host                       : localhost
          DWH database user name                  : ovirt
          DWH database host name validation       : False
          DWH database port                       : 5432
          Configure local DWH database            : False
          Reports installation                    : True
          Reports database name                   : ovirt_er
          Reports database secured connection     : False
          Reports database host                   : localhost
          Reports database user name              : ovirt
          Reports database host name validation   : False
          Reports database port                   : 5432
          Configure local Reports database        : False
         
          Please confirm installation settings (OK, Cancel) [OK]: 
[ INFO  ] Cleaning async tasks and compensations
[ INFO  ] Checking the Engine database consistency
[ INFO  ] Stage: Transaction setup
[ INFO  ] Stopping engine service
[ INFO  ] Stopping dwh service
[ INFO  ] Stopping websocket-proxy service
[ INFO  ] Stage: Misc configuration
[ INFO  ] Stage: Package installation
[ INFO  ] Stage: Misc configuration
[ INFO  ] Backing up database localhost:ovirt to '/var/lib/ovirt-engine/backups/engine-20140729223904.dQpGRz.dump'.
[ INFO  ] Updating Engine database schema
[ INFO  ] Creating/refreshing DWH database schema
[ INFO  ] Deploying Jasper
[ INFO  ] Importing data into Jasper
[ INFO  ] Configuring Jasper Java resources
[ INFO  ] Configuring Jasper Database resources
[ INFO  ] Customizing Jasper
[ INFO  ] Customizing Jasper metadata
[ INFO  ] Generating post install configuration file '/etc/ovirt-engine-setup.conf.d/20-setup-ovirt-post.conf'
[ INFO  ] Stage: Transaction commit
[ INFO  ] Stage: Closing up
         
          --== SUMMARY ==--
         
          SSH fingerprint: 36:C7:7C:1F:6C:BA:8E:A1:C3:5E:30:1B:AB:07:CA:B7
          Internal CA 5D:77:8F:FF:12:7A:47:1A:20:D2:34:5E:83:8D:FB:7B:B3:78:68:55
          Web access is enabled at:
              http://db-172-16-3-150.sky-mobi.com:80/ovirt-engine
              https://db-172-16-3-150.sky-mobi.com:443/ovirt-engine
          In order to configure firewalld, copy the files from
              /etc/ovirt-engine/firewalld to /etc/firewalld/services
              and execute the following commands:
              firewall-cmd -service ovirt-postgres
              firewall-cmd -service ovirt-https
              firewall-cmd -service ovirt-http
          The following network ports should be opened:
              tcp:443
              tcp:5432
              tcp:80
          An example of the required configuration for iptables can be found at:
              /etc/ovirt-engine/iptables.example
         
          --== END OF SUMMARY ==--
         
[ INFO  ] Starting engine service
[ INFO  ] Restarting httpd
[ INFO  ] Starting dwh service
[ INFO  ] Stage: Clean up
          Log file is located at /var/log/ovirt-engine/setup/ovirt-engine-setup-20140729223458-tzk701.log
[ INFO  ] Generating answer file '/var/lib/ovirt-engine/setup/answers/20140729224557-setup.conf'
[ INFO  ] Stage: Pre-termination
[ INFO  ] Stage: Termination
[ INFO  ] Execution of setup completed successfully


配置完, 修改回普通用户.
postgres=# alter role ovirt nosuperuser;
ALTER ROLE

现在可以打开报告了, 从ovirt-engine或以下URL进入.
https://172.16.3.150/ovirt-engine-reports/
oVirt Reports Portal 3.4 added to ovirt-engine - 德哥@Digoal - PostgreSQL research
 

[其他]
1. pg_dump备份问题的几种解决办法, 都无效.
如果数据库使用了ovirt打包的依赖版本, 例如9.3.5, 那么请把这个版本的bin路径加到/etc/profile, 因为执行engine-setup的时候可能用到pg_dump , 版本不对可能导致备份失败.
vi /etc/profile
export PATH=/home/pg93/pgsql/bin:$PATH

退出shell重进, 确认pg_dump路径正确.
# which psql
/home/pg93/pgsql/bin/psql

或者执行engine-setup时设置PATH也行.
或者修改ovirt-engine 的 python脚本.
报错信息
[ INFO  ] Backing up database localhost:ovirt to '/var/lib/ovirt-engine/backups/engine-20140729213449.w8H6bH.dump'.
[ ERROR ] Failed to execute stage 'Misc configuration': Command '/usr/bin/pg_dump' failed to execute

日志中都报错信息, 说明了版本问题.
2014-07-29 21:34:49 DEBUG otopi.plugins.**FILTERED**_engine_setup.**FILTERED**_engine.db.schema plugin.execute:866 execute-output: (
'/usr/bin/pg_dump', '-E', 'UTF8', '--disable-dollar-quoting', '--disable-triggers', '--format=c', '-U', '**FILTERED**', '-h', 'local
host', '-p', '5432', '-f', '/var/lib/**FILTERED**-engine/backups/engine-20140729213449.w8H6bH.dump', '**FILTERED**') stderr:
pg_dump: server version: 9.3.3; pg_dump version: 8.4.20
pg_dump: aborting because of server version mismatch

修改ovirt-engine的python脚本, 还是没有效果.
/usr/share/ovirt-engine/services/ovirt-engine-notifier/ovirt-engine-notifier.py
	self._engineEnv.update({
            'PATH': (
                '/home/pg93/pgsql/bin:/usr/local/sbin:/usr/local/bin:'
                '/usr/sbin:/usr/bin:/sbin:/bin'
            ),

/usr/share/ovirt-engine/services/ovirt-engine/ovirt-engine.py
        self._engineEnv = os.environ.copy()
        self._engineEnv.update({
            'PATH': (
                '/home/pg93/pgsql/bin:/usr/local/sbin:/usr/local/bin:'
                '/usr/sbin:/usr/bin:/sbin:/bin'
            ),

修改后, 日志依旧显示使用了/usr/bin/pg_dump
/var/log/ovirt-engine/setup/
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:468 ENVIRONMENT DUMP - BEGIN
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/chkconfig=str:'/sbin/chkconfig'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/date=str:'/bin/date'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/hwclock=str:'/sbin/hwclock'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/initctl=str:'/sbin/initctl'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/ip=str:'/sbin/ip'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/ntpq=str:'/usr/sbin/ntpq'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/pg_dump=str:'/usr/bin/pg_dump'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/pg_restore=str:'/usr/bin/pg_restore'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/psql=str:'/usr/bin/psql'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/reboot=str:'/sbin/reboot'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/restorecon=str:'/sbin/restorecon'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:478 ENV COMMAND/service=str:'/sbin/service'
2014-07-28 13:33:38 DEBUG otopi.context context.dumpEnvironment:482 ENVIRONMENT DUMP - END

最终选择了覆盖.
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/pg_dump /usr/bin
cp: overwrite `/usr/bin/pg_dump'? y 
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/pg_restore /usr/bin
cp: overwrite `/usr/bin/pg_restore'? y
[root@db-172-16-3-150 ~]# cp /home/pg93/pgsql/bin/psql /usr/bin
cp: overwrite `/usr/bin/psql'? y


[参考]
1.  http://wiki.ovirt.org/Ovirt_Reports
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
关系型数据库 Java 应用服务中间件
Database Visualization using Metabase Part 1 - Install Metabase on Ubuntu 16.04
In this tutorial, we will install Metabase on an Alibaba Cloud ECS Ubuntu 16.04 server to achieve data visualization.
1932 0
Database Visualization using Metabase Part 1 - Install Metabase on Ubuntu 16.04
|
安全 网络协议 应用服务中间件
Setting Up a Server Cluster for Enterprise Web Apps – Part 3
In this three-part tutorial, we will discover how to set up a server cluster using Alibaba Cloud ECS and WordPress.
4576 0
Setting Up a Server Cluster for Enterprise Web Apps – Part 3
|
前端开发 应用服务中间件 网络安全
Setting up a Server Cluster for Enterprise Web Apps – Part 2
In this three-part tutorial, we will discover how to set up a server cluster using Alibaba Cloud ECS and WordPress.
1832 0
Setting up a Server Cluster for Enterprise Web Apps – Part 2
|
前端开发 网络协议 MySQL
Setting Up a Server Cluster for Enterprise Web Apps – Part 1
In this three-part tutorial, we will discover how to set up a server cluster using Alibaba Cloud ECS and WordPress.
12057 0
Setting Up a Server Cluster for Enterprise Web Apps – Part 1
|
网络协议 虚拟化
下一篇
DDNS