CBoard开源数据可视化工具
先容
- 什么是CBoard?CBoard是一个开源的数据可视化工具,皆在简化数据分析过程并提供美观、交互性强的仪表盘。该项目由张洋开发,并在GitCode上分享,让更多的开发者和数据分析师可以或许轻松地创建、分享和协作他们的数据故事。
资源列表
操作系统设置主机名IP所需软件CentOS 7.98C4Gcboard192.168.93.101apache-maven-3.9.0-bin.tar.gz
apache-tomcat-8.5.78.tar.gz
jdk-8u162-linux-x64.tar.gz
mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
phantomjs-2.1.1-linux-x86_64.tar.bz2win 11略略略Edge浏览器 基础情况
- systemctl stop firewalld
- systemctl disable firewalld
复制代码
- setenforce 0
- sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
复制代码
- hostnamectl set-hostname cboard
复制代码 一、安装JDK
- # 卸载原有的JDK环境
- [root@cboard ~]# yum -y remove java*
- # 安装新的JDK环境
- [root@cboard ~]# tar -zxvf jdk-8u162-linux-x64.tar.gz
- [root@cboard ~]# mv jdk1.8.0_162 /usr/local/java
- [root@cboard ~]# vim /etc/profile
- export JAVA_HOME=/usr/local/java/
- export PATH=$JAVA_HOME/bin:$PATH
- export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- [root@cboard ~]# source /etc/profile
- [root@cboard ~]# java -version # 查看版本
- java version "1.8.0_162"
复制代码 二、安装Maven
2.1、安装Maven
- [root@cboard ~]# tar -zxvf apache-maven-3.9.0-bin.tar.gz
- [root@cboard ~]# mv apache-maven-3.9.0 /usr/local/maven
- [root@cboard ~]# vim /etc/profile
- MAVEN_HOME=/usr/local/maven
- PATH=$PATH:$MAVEN_HOME/bin
- [root@cboard ~]# mvn -version # 查看Maven版本
- Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
复制代码 2.2、设置Maven
- 默认使用的是国外的仓库,改为阿里云
- 默认大概是在153行左右,把表明去掉,更改为下面的内容
- [root@cboard ~]# vim /usr/local/maven/conf/settings.xml
- <mirror>
- <id>alimaven</id>
- <mirrorOf>central</mirrorOf>
- <name>aliyun maven</name>
- <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
- </mirror>
复制代码 三、安装Tomcat8
- [root@cboard ~]# tar -zxvf apache-tomcat-8.5.78.tar.gz
- [root@cboard ~]# mv apache-tomcat-8.5.78 /usr/local/tomcat8
复制代码 四、安装MySQL5版本
4.1、安装相关依赖
- [root@cboard ~]# yum -y remove mariadb*
复制代码
- [root@cboard ~]# yum -y install vim wget net-tools lrzsz
复制代码
- [root@cboard ~]# yum -y install libaio gcc gcc-c++
复制代码
- [root@cboard ~]# useradd -M -s /sbin/nologin mysql
复制代码 4.2、二进制安装
- [root@cboard ~]# tar -zxvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
- [root@cboard ~]# mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql
- [root@cboard ~]# mkdir /usr/local/mysql/data
- [root@cboard ~]# chown -R mysql:mysql /usr/local/mysql/data/
- [root@cboard ~]# cd /usr/local/mysql/bin/
- # 执行下面命令配置和初始化数据库,回显的最后12字母就是临时root密码,要牢记,等下会用到
- [root@cboard bin]# ./mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
- ######## 部分内容省略
- 2024-05-01T02:37:58.642067Z 1 [Note] A temporary password is generated for root@localhost: gCqlrw1yOH=a
- ######## 部分内容省略
复制代码 4.3、设定设置文件
- 二进制安装的MySQL设置文件跟源码编译安装的设置文件类似。
- [root@cboard ~]# vim /etc/my.cnf
- [client]
- socket=/usr/local/mysql/data/mysql.sock
- [mysqld]
- socket=/usr/local/mysql/data/mysql.sock
- # 绑定监听地址0.0.0.0
- bind-address = 0.0.0.0
- # 禁止域名解析,减少mysql对外部连接客户端DNS解析的时间
- skip-name-resolve
- # 设置端口为3306
- port=3306
- # 设置mysql的安装目录
- basedir=/usr/local/mysql
- # 设置mysql数据库的数据的存放目录
- datadir=/usr/local/mysql/data
- # 允许最大连接数
- max_connections=2048
- # 服务端使用的字符集默认为utf8
- character-set-server=utf8
- # 创建新表时将使用默认存储引擎
- default-storage-engine=INNODB
- # sql语句不区分大小写
- lower_case_table_names=1
- # 设置一次消息传输的最大值
- max_allowed_packet=16M
复制代码
- [root@cboard ~]# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
- [root@cboard ~]# . /etc/profile
复制代码 4.4、设置systemcatl方式启动
- [root@cboard ~]# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
- [root@cboard ~]# chmod +x /etc/rc.d/init.d/mysqld
- [root@cboard ~]# vim /lib/systemd/system/mysqld.service
- [Unit]
- Description=mysqld
- After=network.target
- [Service]
- Type=forking
- ExecStart=/etc/rc.d/init.d/mysqld start
- ExecReload=/etc/rc.d/init.d/mysqld restart
- ExecStop=/etc/rc.d/init.d/mysqld stop
- PrivateTmp=true
- [Install]
- WantedBy=multi-user.target
- [root@cboard ~]# systemctl daemon-reload
- [root@cboard ~]# systemctl start mysqld
- [root@cboard ~]# systemctl enable mysqld
复制代码 4.5、访问MySQL数据库
- [root@cboard ~]# mysql -u root -p
- Enter password: # 输入临时密码
- mysql> set password=password('wzh.2005');
复制代码 五、安装PhantomJS
- # 安装软件依赖
- [root@cboard ~]# yum install -y gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
- [root@cboard ~]# yum install -y bitmap-fonts bitmap-fonts-cjk
- [root@cboard ~]# yum -y install bzip2
- [root@cboard ~]# tar xvf phantomjs-2.1.1-linux-x86_64.tar.bz2
- [root@cboard ~]# mv phantomjs-2.1.1-linux-x86_64 /usr/local/
- [root@cboard ~]# ln -sf /usr/local/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
复制代码 六、git下载源码包
- [root@cboard ~]# yum -y install git*
复制代码
- [root@cboard ~]# git clone https://github.com/yzhang921/CBoard.git
- # 拷贝之后root目录下就会有一个CBoard的目录
- [root@cboard ~]# ls CBoard/
- changelog imgs LICENSE.txt README.md sql
- Dockerfile lib pom.xml Readme_zh.md src
- [root@cboard ~]# cd CBoard/
- # 使用的版本是0.4
- [root@cboard CBoard]# git checkout branch-0.4
- 分支 branch-0.4 设置为跟踪来自 origin 的远程分支 branch-0.4。
- 切换到一个新分支 'branch-0.4'
复制代码 七、修改Maven设置文件
- [root@cboard ~]# vim CBoard/src/main/resources/config.properties
- validationQuery=SELECT 1
- jdbc_url=jdbc:mysql://192.168.93.101:3306/cboard # 修改,下面会导入元数据文件cboard数据库
- jdbc_username=root # MySQL用户
- jdbc_password=wzh.2005 # MySQl用户密码
- dataprovider.resultLimit=3000000 # 修改
- admin_user_id=1
- phantomjs_path=/usr/local/phantomjs-2.1.1-linux-x86_64/bin/phantomjs # 修改为phantomjs的绝对安装路径即可
复制代码 八、设置平台默认语言
- [root@cboard ~]# vim CBoard/src/main/webapp/org/cboard/Settings.js
- var settings = {
- preferredLanguage: "cn" // en/cn: 可选值en/cn
- };
复制代码 九、删除SQL server驱动
- 由于源代码以来中默认包含了SQL Server的JDBC驱动,但是该驱动在共有Maven仓库不存在。这个实验的使用不计划SQL Server数据库,以是把CMoard目录下的pom.xml中的下面依赖删除
- [root@cboard ~]# vim CBoard/pom.xml
- <dependency>
- <groupId>com.microsoft.sqlserver</groupId>
- <artifactId>sqljdbc4</artifactId>
- <version>4.0</version>
- </dependency>
复制代码 十、初始化元数据
- [root@cboard ~]# yum -y install unzip.x86_64
- [root@cboard ~]# unzip foodmart.zip
复制代码
- [root@cboard ~]# mysql -u root -pwzh.2005
- mysql> create database cboard;
- mysql> use cboard
- mysql> source /root/CBoard/sql/mysql/mysql.sql
- mysql> source /root/foodmart.sql
- mysql> source /root/cboard_demo.sql
- # 查询数据库
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | cboard |
- | cboard_demo2 |
- | foodmart2 |
- | mysql |
- | performance_schema |
- | sys |
- +--------------------+
- 7 rows in set (0.00 sec)
复制代码 十一、打包源代码
- [root@cboard ~]# cd CBoard/
- [root@cboard CBoard]# mvn install:install-file -Dfile=lib/sqljdbc4-4.0.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
- [root@cboard CBoard]# mvn clean package
复制代码
- 打包完成之后,CMoard目录下会多出一个target目录,这个目录下面有我们需要的cboard.war文件,拷贝文件到tomcat目录下的webaaps目录下,然后开启服务,tomcat会主动剖析cboard.war文件,然后生成一个cboard目录
- [root@cboard CBoard]# cp -p target/cboard.war /usr/local/tomcat8/webapps/
- [root@cboard CBoard]# /usr/local/tomcat8/bin/startup.sh
复制代码 十二、MySQL授权
- 分别对cboard、cboard_demo2、foodmart2三个数据库进行授权
- [root@cboard ~]# mysql -u root -pwzh.2005
- mysql> GRANT ALL PRIVILEGES ON cboard.* TO 'root'@'%' IDENTIFIED BY 'wzh.2005' WITH GRANT OPTION;
- mysql> GRANT ALL PRIVILEGES ON foodmart2.* TO 'root'@'%' IDENTIFIED BY 'wzh.2005' WITH GRANT OPTION;
- mysql> GRANT ALL PRIVILEGES ON cboard_demo.* TO 'root'@'%' IDENTIFIED BY 'wzh.2005' WITH GRANT OPTION;
- mysql> FLUSH PRIVILEGES;
复制代码 十三、访问
- 访问地址:http://192.168.93.101:8080/cboard
- 默认用户:admin 默认密码:root123
十四、解决登录进入Error报错
- 删除掉cboard,用最粗笨的方法,一个一个的SQL指令实验,
- mysql> CREATE DATABASE cboard CHARACTER SET utf8;
- mysql> USE cboard;
- mysql> CREATE TABLE dashboard_board (
- -> board_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(50) NOT NULL,
- -> category_id bigint(20) DEFAULT NULL,
- -> board_name varchar(100) NOT NULL,
- -> layout_json text,
- -> PRIMARY KEY (board_id)
- -> );
- mysql> CREATE TABLE dashboard_category (
- -> category_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> category_name varchar(100) NOT NULL,
- -> user_id varchar(100) NOT NULL,
- -> PRIMARY KEY (category_id)
- -> );
- mysql> CREATE TABLE dashboard_datasource (
- -> datasource_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(50) NOT NULL,
- -> source_name varchar(100) NOT NULL,
- -> source_type varchar(100) NOT NULL,
- -> config text,
- -> PRIMARY KEY (datasource_id)
- -> );
- mysql> CREATE TABLE dashboard_widget (
- -> widget_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(100) NOT NULL,
- -> category_name varchar(100) DEFAULT NULL,
- -> widget_name varchar(100) DEFAULT NULL,
- -> data_json text,
- -> PRIMARY KEY (widget_id)
- -> );
- mysql> CREATE TABLE dashboard_dataset (
- -> dataset_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(100) NOT NULL,
- -> category_name varchar(100) DEFAULT NULL,
- -> dataset_name varchar(100) DEFAULT NULL,
- -> data_json text,
- -> PRIMARY KEY (dataset_id)
- -> );
- mysql> CREATE TABLE dashboard_user (
- -> user_id varchar(50) NOT NULL,
- -> login_name varchar(100) DEFAULT NULL,
- -> user_name varchar(100) DEFAULT NULL,
- -> user_password varchar(100) DEFAULT NULL,
- -> user_status varchar(100) DEFAULT NULL,
- -> PRIMARY KEY (user_id)
- -> );
- mysql> INSERT INTO dashboard_user (user_id,login_name,user_name,user_password)
- -> VALUES('1', 'admin', 'Administrator', 'ff9830c42660c1dd1942844f8069b74a');
- mysql> CREATE TABLE dashboard_user_role (
- -> user_role_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(100) DEFAULT NULL,
- -> role_id varchar(100) DEFAULT NULL,
- -> PRIMARY KEY (user_role_id)
- -> );
- mysql> CREATE TABLE dashboard_role (
- -> role_id varchar(100) NOT NULL,
- -> role_name varchar(100) DEFAULT NULL,
- -> user_id varchar(50) DEFAULT NULL,
- -> PRIMARY KEY (role_id)
- -> );
- mysql> CREATE TABLE dashboard_role_res (
- -> role_res_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> role_id varchar(100) DEFAULT NULL,
- -> res_type varchar(100) DEFAULT NULL,
- -> res_id bigint(20) DEFAULT NULL,
- -> permission varchar(20) DEFAULT NULL,
- -> PRIMARY KEY (role_res_id)
- -> );
- mysql> CREATE TABLE dashboard_job (
- -> job_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> job_name varchar(200) DEFAULT NULL,
- -> cron_exp varchar(200) DEFAULT NULL,
- -> start_date timestamp NULL DEFAULT NULL,
- -> end_date timestamp NULL DEFAULT NULL,
- -> job_type varchar(200) DEFAULT NULL,
- -> job_config text,
- -> user_id varchar(100) DEFAULT NULL,
- -> last_exec_time timestamp NULL DEFAULT NULL,
- -> job_status bigint(20),
- -> exec_log text,
- -> PRIMARY KEY (job_id)
- -> );
- mysql> CREATE TABLE dashboard_board_param (
- -> board_param_id bigint(20) NOT NULL AUTO_INCREMENT,
- -> user_id varchar(50) NOT NULL,
- -> board_id bigint(20) NOT NULL,
- -> config text,
- -> PRIMARY KEY (board_param_id)
- -> );
- mysql> ALTER TABLE dashboard_dataset ADD create_time TIMESTAMP DEFAULT now();
- mysql> ALTER TABLE dashboard_dataset ADD update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
- mysql> UPDATE dashboard_dataset SET update_time = create_time;
- mysql> CREATE TRIGGER insert_dataset_update_time_trigger
- -> BEFORE INSERT ON dashboard_dataset FOR EACH ROW SET new.update_time = now();
- mysql> CREATE TRIGGER update_dataset_update_time_trigger
- -> BEFORE UPDATE ON dashboard_dataset FOR EACH ROW SET new.update_time = now();
- mysql> ALTER TABLE dashboard_datasource ADD create_time TIMESTAMP DEFAULT now();
- mysql> ALTER TABLE dashboard_datasource ADD update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
- mysql> UPDATE dashboard_datasource SET update_time = create_time;
- mysql> CREATE TRIGGER insert_datasource_update_time_trigger
- -> BEFORE INSERT ON dashboard_datasource FOR EACH ROW SET new.update_time = now();
- mysql> CREATE TRIGGER update_datasource_update_time_trigger
- -> BEFORE UPDATE ON dashboard_datasource FOR EACH ROW SET new.update_time = now();
- mysql> ALTER TABLE dashboard_widget ADD create_time TIMESTAMP DEFAULT now();
- mysql> ALTER TABLE dashboard_widget ADD update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
- mysql> UPDATE dashboard_widget SET update_time = create_time;
- mysql> CREATE TRIGGER insert_widget_update_time_trigger
- -> BEFORE INSERT ON dashboard_widget FOR EACH ROW SET new.update_time = now();
- mysql> CREATE TRIGGER update_widget_update_time_trigger
- -> BEFORE UPDATE ON dashboard_widget FOR EACH ROW SET new.update_time = now();
- mysql> ALTER TABLE dashboard_board ADD create_time TIMESTAMP DEFAULT now();
- mysql> ALTER TABLE dashboard_board ADD update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
- mysql> UPDATE dashboard_board SET update_time = create_time;
- mysql> CREATE TRIGGER insert_board_update_time_trigger
- -> BEFORE INSERT ON dashboard_board FOR EACH ROW SET new.update_time = now();
- mysql> CREATE TRIGGER update_board_update_time_trigger
- -> BEFORE UPDATE ON dashboard_board FOR EACH ROW SET new.update_time = now();
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |