### Start Tomcat and view logs
Source: https://help.fanruan.com/finebi-tw/doc-view-1593.html
Start the Tomcat server and monitor the real-time log. Successful startup is indicated by the appearance of '重啟耗時' in the log. If the error 'Database is not initialized' occurs, check read/write permissions and use 'chmod -R 777 tomcat' to configure them.
```bash
cd /home/BItest/tomcat/bin
```
```bash
./startup.sh
```
```bash
cd /home/BItest/tomcat/logs
```
```bash
tail -f catalina.out
```
--------------------------------
### PostgreSQL Date Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering PostgreSQL data by date parameters. Each example uses TO_CHAR to format date columns and compares against parameter placeholders like ${_Year A_}, ${_Year_}, ${_Month_}, ${_Date Parameter_}, ${_Start Date_}, ${_End Date_}, ${_Start Year_}, ${_Start Month_}, ${_End Year_}, ${_End Month_}, and ${_Quarter_}. The recommended parameter type is Text for all except the Date example, which uses Date.
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY_ ')='${_Year A_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY_ ')='${_Year_}' and EXTRACT(MONTH FROM "_Sales Date_ ")='${_Month_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') in ('${_Date Parameter_}')
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') between '${_Start Date_}' and '${_End Date_}'
```
```sql
SELECT * FROM DEMO_CONTRACT WHERE TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') >=concat('${_Start Year_}',case when cast('${_Start Month_}' as tinyint)>9 then '${_Start Month_}' else concat('0','${_Start Month_}') end ) and TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') <=concat('${_End Year_}',case when cast('${_End Month_}' as tinyint)>9 then '${_End Month_}' else concat('0','${_End Month_}') end )
```
```sql
SELECT * FROM _DEMO_CONTRACT_ WHERE TO_CHAR("_Registration Date_ ",'_YYYY_ ')='${_Year_}' and FLOOR((EXTRACT(MONTH FROM "_Registration Date_ ")+2)/3) ='${_Quarter_}'
```
--------------------------------
### XML file example with frtest node
Source: https://help.fanruan.com/finebi-tw/doc-view-1199.html
Example XML file used as a data source for the XML dataset. It uses UTF-8 encoding and contains multiple key nodes, with the frtest node used in the documentation.
```xml
ALFKIALfreds Futterkiste90ANATRAna Trujillo Emparedados y helados90
```
--------------------------------
### 检查OpenSSH服务安装状态
Source: https://help.fanruan.com/finebi/doc-view-1567.html
在CentOS 7系统上以root用户运行yum命令,检查是否已安装OpenSSH服务。若输出显示has no installed packages或command not found,则需安装。
```bash
yum -q list openssh-server
```
--------------------------------
### SQL Server Date Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering Microsoft SQL Server data by date parameters. Each example corresponds to a specific date type (Year, Year-Month, Date, Date Interval, Year-Month Interval, Year-Quarter) and uses the recommended parameter type (Text or Date) as shown in the table.
```sql
SELECT * FROM _Internet Access Data_ WHERE YEAR(_Sales Date_)='${_Year_}'
```
```sql
SELECT * FROM _Internet Access Data_ WHERE YEAR(_Sales Date_)='${_Year_}' and month(_Sales Date_)='${_Month_}'
```
```sql
SELECT * FROM _Internet Access Data_ WHERE CAST(_Statistical Date_ as varchar) in ('${_Date_}')
```
```sql
SELECT * FROM _Internet Access Data_ WHERE _Statistical Date_ between '${_Start Date_}' and '${_End Date_}'
```
```sql
SELECT * FROM _Internet Access Data_ WHERE format(_Statistical Date_ ,'yyyyMM') >=concat('${_Start Year_}',case when '${_Start Month_}'>9 then '${_Start Month_}'else concat(0,'${_Start Month_}') end ) and format(_Statistical Date_ ,'yyyyMM') <=concat('${_End Year_}',case when '${_End Month_}'>9 then '${_End Month_}'else concat(0,'${_End Month_}') end )
```
```sql
SELECT * FROM _Internet Access Data_ WHERE CAST(YEAR(_Registration Date_) as varchar) = '${_Year_}' and CAST(FLOOR((MONTH(_Registration Date_)+2)/3) as varchar) = '${_Quarter_}'
```
--------------------------------
### Create parent directory for SFTP storage
Source: https://help.fanruan.com/finebi/doc-view-1567.html
Creates the parent directory for storing project and backup files. Example uses /home/fanruan.
```bash
mkdir /home/fanruan
```
--------------------------------
### Create a.html for HTML5 access
Source: https://help.fanruan.com/finebi-tw/doc-view-903.html
Create a.html for HTML5 access. Includes viewport meta for mobile. Requires installing the HTML5 access dashboard/engineering.
```html
FineReport報表
```
--------------------------------
### Numeric format patterns with FORMAT
Source: https://help.fanruan.com/finebi-tw/doc-view-1454.html
These FORMAT formulas demonstrate numeric formatting patterns using the example value 1234.56. Each pattern produces a specific output: #,##0.00 gives 1234.50, #,##0 gives 1234, ¥#,##0.00 gives ¥1234.50, 0% gives 150%, 0.000% gives 150.000%, ##0.0E0 gives 6.789E3, and 0.00E00 gives 6.79E03.
```text
FORMAT(1234.5, "#,##0.00")
```
```text
FORMAT(1234.5, "#,##0")
```
```text
FORMAT(1234.5, "¥#,##0.00")
```
```text
FORMAT(1.5, "0%")
```
```text
FORMAT(1.5, "0.000%")
```
```text
FORMAT(6789, "##0.0E0")
```
```text
FORMAT(6789, "0.00E00")
```
--------------------------------
### 重启WebLogic工程
Source: https://help.fanruan.com/finebi/doc-view-1322.html
进入startWebLogic.sh所在目录,以后台方式启动工程,并验证进程。
```bash
cd /web/weblogic/Oracle/Middleware/user_projects/domains
nohup ./startWebLogic.sh &
```
```bash
ps -ef | grep weblogic
```
--------------------------------
### PostgreSQL text parameter SQL examples
Source: https://help.fanruan.com/finebi-tw/doc-view-1225.html
PostgreSQL text parameter examples: single value, multiple values, and conditional filtering when parameter is empty. The last example uses tags to show all rows when the parameter is empty.
```sql
SELECT * FROM demo_contract WHERE "合同類型"='${正文參數}'
```
```sql
SELECT * FROM demo_contract WHERE "合同類型" in ('${正文參數}')
```
```sql
SELECT * FROM demo_contract WHERE 1=1 and "合同類型" in ('${正文參數}')
```
--------------------------------
### 重启WebSphere工程
Source: https://help.fanruan.com/finebi/doc-view-1322.html
进入startServer.sh所在目录,启动应用程序服务器(将server1替换为实际名称),并验证进程。
```bash
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin
```
```bash
./startServer.sh server1
```
```bash
ps -ef | grep websphere
```
--------------------------------
### Presto Date Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering Presto data by date parameters. Each example corresponds to a date type (Year, Year-Month, Date, Date Interval, Year-Month Interval, Year-Quarter) and uses the recommended parameter type (Text or Date) as shown in the table.
```sql
SELECT * FROM _new_salesdetail_ WHERE cast(year(_Sales Date_) as varchar)='${_Year_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY_ ')='${_Year_}' and cast(EXTRACT(MONTH FROM "_Sales Date_ ") as varchar)='${_Month_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') in ('${_Date Parameter_}')
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') between '${_Start Date_}' and '${_End Date_}'
```
```sql
SELECT * FROM DEMO_CONTRACT WHERE TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') >=concat('${_Start Year_}',case when cast('${_Start Month_}' as tinyint)>9 then '${_Start Month_}' else concat('0','${_Start Month_}') end ) and TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') <=concat('${_End Year_}',case when cast('${_End Month_}' as tinyint)>9 then '${_End Month_}' else concat('0','${_End Month_}') end )
```
```sql
SELECT * FROM _DEMO_CONTRACT_ WHERE TO_CHAR("_Registration Date_ ",'_YYYY_ ')='${_Year_}' and cast(FLOOR((EXTRACT(MONTH FROM "_Registration Date_ ")+2)/3) as varchar)='${_Quarter_}'
```
--------------------------------
### Add welcome-file-list to web.xml
Source: https://help.fanruan.com/finebi-tw/doc-view-903.html
Add this welcome-file-list before in web.xml to set a.html as a welcome page. If web.xml does not exist, create it in webroot\WEB-INF.
```xml
index.htmlindex.htma.htmlindex.jsp
```
--------------------------------
### Apache Impala Date Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering by date parameters in Apache Impala. Each example corresponds to a date type (Year, Year-Month, Date, Date Interval, Year-Month Interval, Year-Quarter) and uses the recommended parameter type (Text or Date) as shown in the table.
```SQL
SELECT * FROM _xxxx_ WHERE cast(year(_Sales Date_) as STRING)='${_Year_}'
```
```SQL
SELECT * FROM _xxxx_ WHERE cast(year(_Sales Date_) as STRING)='${_Year_}' and cast(month(_Sales Date_) as STRING)='${_Month_}'
```
```SQL
SELECT * FROM _xxxx_ WHERE _Registration Date_ in ('${_Date Parameter_}')
```
```SQL
SELECT * FROM _xxxx_ WHERE _Registration Date_ between '${_Start Date_}' and '${_End Date_}'
```
```SQL
SELECT * FROM _xxxx_ WHERE TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') >=concat('${_Start Year_}',case when cast('${_Start Month_}' as tinyint)>9 then '${_Start Month_}' else concat('0','${_Start Month_}') end ) and TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') <=concat('${_End Year_}',case when cast('${_End Month_}' as tinyint)>9 then '${_End Month_}' else concat('0','${_End Month_}') end )
```
```SQL
SELECT * FROM _xxxx_ WHERE cast(year(_Registration Date_) as STRING)='${_Year_}' and cast(truncate((month(_Registration Date_)+2)/3) as STRING)='${_Quarter_}'
```
--------------------------------
### 创建webroot.ear目录
Source: https://help.fanruan.com/finebi/doc-view-655.html
在WebSphere工程节点目录下创建webroot.ear目录,用于存放FineBI工程文件。
```bash
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/
mkdir webroot.ear
```
--------------------------------
### 重启Tomcat工程并查看日志
Source: https://help.fanruan.com/finebi/doc-view-1322.html
进入bin目录执行startup.sh启动工程,然后查看catalina.out日志确认重启结果。
```bash
cd /home/wendy/tomcat-linux/bin
./startup.sh
```
```bash
cd /home/wendy/tomcat-linux/logs
tail -f catalina.out
```
--------------------------------
### Oracle Date Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for Oracle (similar to Teradata) date parameters. Each example shows how to filter by a specific date type (Year, Year-Month, Date, Date Interval, Year-Month Interval, Year-Quarter) using TO_CHAR and EXTRACT functions with FineBI parameters. The recommended parameter type is Text for all except the Date type, which uses Date.
```sql
SELECT * FROM _Internet Access Data_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY_ ')='${_Year_A_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY_ ')='${_Year_}' and EXTRACT(MONTH FROM "_Sales Date_ ")='${_Month_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') in ('${_Date Parameter_}')
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYY-MM-DD_ ') between '${_Start Date_}' and '${_End Date_}'
```
```sql
SELECT * FROM _new_salesdetail_ WHERE TO_CHAR("_Sales Date_ ",'_YYYYMM_ ') >=concat('${_Start Year_}',case when '${_Start Month_}'>9 then '${_Start Month_}'else concat(0,'${_Start Month_}') end ) and TO_CHAR("_Sales Date_ ",'_YYYYMM_ ') <=concat('${_End Year_}',case when '${_End Month_}'>9 then '${_End Month_}' else concat(0,'${_End Month_}') end )
```
```sql
SELECT * FROM _DEMO_CONTRACT_ WHERE TO_CHAR("_Registration Date_ ",'_YYYY_ ')='${_Year_}' and FLOOR((EXTRACT(MONTH FROM "_Registration Date_ ")+2)/3)='${_Quarter_}'
```
--------------------------------
### 拷贝webroot文件夹至webroot.ear
Source: https://help.fanruan.com/finebi/doc-view-655.html
将FineBI的webroot文件夹拷贝到webroot.ear目录下。
```bash
cp -r /opt/FineBI/webapps/webroot
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/webroot.ear
```
--------------------------------
### 打包webroot工程为war包
Source: https://help.fanruan.com/finebi/doc-view-390.html
在FineBI安装目录的webroot下执行,将工程打包为webroot.war。
```bash
jar -cvf webroot.war ./*
```
--------------------------------
### TXT file example with comma delimiter
Source: https://help.fanruan.com/finebi-tw/doc-view-1197.html
Example TXT file content used in the '準備正文檔案' section. It uses comma as the delimiter and has no specified encoding (default). The first line contains column headers: Name, Capital, Continent, Area, Population.
```text
Name,Capital,Continent,Area,Population Argentina,Buenos Aires,South America,2777815.00,32300003.00 Bolivia,La Paz,South America,1098575.00,7300000.00 Brazil,Brasilia,South America,8511196.00,150400000.00 Canada,Ottawa,North America,9976147.00,26500000.00 Chile,Santiago,South America,756943.00,13200000.00 Colombia,Bagota,South America,1138907.00,33000000.00 Cuba,Havana,North America,114524.00,10600000.00 Ecuador,Quito,South America,455502.00,10600000.00 El Salvador,San Salvador,North America,20865.00,5300000.00 Guyana,Georgetown,South America,214969.00,800000.00 Jamaica,Kingston,North America,11424.00,2500000.00 Mexico,Mexico City,North America,1967180.00,88600000.00 Nicaragua,Managua,North America,139000.00,3900000.00 Paraguay,Asuncion,South America,406576.00,4660000.00 Peru,Lima,South America,1285215.00,21600000.00 United States of America,Washington,North America,9363130.00,249200000.00 Uruguay,Montevideo,South America,176140.00,3002000.00 Venezuela,Caracas,South America,912047.00,19700000.00
```
--------------------------------
### Create bi-thirdB.jar with jar command
Source: https://help.fanruan.com/finebi/doc-view-665.html
Run this command in the temporary folder (e.g., D:\aa) after extracting the org folder from fine-bi-engine-third-6.0.jar. It creates the bi-thirdB.jar file that must be moved to Resin_HOME%\webapps\webroot\WEB-INF\lib.
```shell
jar -cf0M bi-thirdB.jar ./
```
--------------------------------
### 加载 FineAI Docker 镜像
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 docker load 命令导入 FineAI 镜像文件。
```bash
docker load -i fine-ai-base_v0_1.tar
```
--------------------------------
### Apache Impala Text Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering by text parameters in Apache Impala. The first retrieves a single value, the second retrieves multiple values, and the third retrieves all values when the parameter is empty and parameter values when not empty.
```SQL
SELECT * FROM _demo_contract_ WHERE _Contract Type_ ='${_Text Parameter_}'
```
```SQL
SELECT * FROM _demo_contract_ WHERE _Contract Type_ in ('${_Text Parameter1_}')
```
```SQL
SELECT * FROM _demo_contract_ WHERE 1=1 and _Contract Type_ in ('${_Text Parameter_}')
```
--------------------------------
### 启动SSH服务
Source: https://help.fanruan.com/finebi/doc-view-1567.html
如果SSH服务未运行,使用service sshd start命令启动它。
```bash
service sshd start
```
--------------------------------
### Oracle Text Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for Oracle text parameters. The first retrieves a single value, the second retrieves multiple values using IN, and the third retrieves all values when the parameter is empty and parameter values when not empty, using the tag. All recommend the Text parameter type.
```sql
SELECT * FROM _demo_contract_ WHERE "_Contract Type_ "='${_Text Parameter_}'
```
```sql
SELECT * FROM _demo_contract_ WHERE "_Contract Type_ " in ('${_Text Parameter_}')
```
```sql
SELECT * FROM _demo_contract_ WHERE 1=1 and "_Contract Type_ " in ('${_Text Parameter_}')
```
--------------------------------
### 修改操作日志存储位置(Windows setenv.bat)
Source: https://help.fanruan.com/finebi/doc-view-599.html
用于在 Windows 的 Tomcat 工程中修改操作日志存储位置。需要进入 %Tomcat_HOME%\bin 目录,在 setenv.bat 文件中添加此设置,然后重启工程。变量 SWIFT_HOME 指定新的日志路径。
```bat
SET "JAVA_OPTS=%JAVA_OPTS% -DSWIFT_HOME=D:\path\logs"
```
--------------------------------
### SQL Server Text Parameter SQL Examples
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
SQL examples for filtering Microsoft SQL Server data by text parameters. The first two handle single and multiple value retrieval, while the last two show how to retrieve all values when the parameter is empty and parameter values when not empty, using either a conditional expression or a parameter tag.
```sql
SELECT * FROM _Internet Access Data_ WHERE _Contract Type_ ='${_Text Parameter_}'
```
```sql
SELECT * FROM _Internet Access Data_ WHERE _Contract Type_ in ('${_Text Parameter_}')
```
```sql
SELECT * FROM _new_dian_ where 1=1 ${if(len(R _egion2_) == 0,"","and _Region_ in ('" + _Region2_ + "')")}
```
```sql
SELECT * FROM _new_dian_ where 1=1 and _Region_ in ('${_Region_}')
```
--------------------------------
### 设置目录所有者
Source: https://help.fanruan.com/finebi/doc-view-1564.html
设置目录 /home/ftpuser 的所有者为用户 ftpuser。
```bash
sudo chown ftpuser:ftpuser /home/ftpuser
```
--------------------------------
### 解壓 webroot 工程檔案
Source: https://help.fanruan.com/finebi-tw/doc-view-1333.html
進入 Tomcat 的 webapps 目錄並解壓 webroot.zip 工程檔案。
```bash
cd /usr/BI/apache-tomcat-9.0.44/webapps
unzip webroot.zip
```
--------------------------------
### JSON response example
Source: https://help.fanruan.com/finebi/doc-view-2641.html
JSON response snippet showing a field object with extraInfo and data properties.
```json
{
"extraInfo": null
},
"data": []
}
}
```
--------------------------------
### 修改操作日志存储位置(Linux setenv.sh)
Source: https://help.fanruan.com/finebi/doc-view-599.html
用于在 Linux 的 Tomcat 工程中修改操作日志存储位置。需要进入 %Tomcat_HOME%\bin 目录,在 setenv.sh 文件中添加此设置,然后重启工程。变量 SWIFT_HOME 指定新的日志路径。
```bash
JAVA_OPTS="$JAVA_OPTS -DSWIFT_HOME=\home\path\logs"
```
--------------------------------
### 在rc.local中添加FineBI启动命令
Source: https://help.fanruan.com/finebi/doc-view-24.html
在rc.local文件最后一行添加FineBI的启动命令,需使用绝对路径,路径需根据实际安装位置修改。
```bash
nohup /opt/FineBI/bin/finebi &
```
--------------------------------
### ClickHouse Date Interval Filter SQL
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
Use for filtering by a date interval. The start and end dates are passed as date parameters and used in a BETWEEN clause.
```sql
SELECT * FROM _xxxx_ WHERE _Registration Date_ between '${_Start Date_}' and '${_End Date_}'
```
--------------------------------
### 启动FineBI工程
Source: https://help.fanruan.com/finebi/doc-view-24.html
使用nohup和&组合命令在后台启动FineBI,使进程在退出账号或关闭终端后继续运行。
```bash
nohup ./finebi &
```
--------------------------------
### SQL Query to Get Column Names from information_schema
Source: https://help.fanruan.com/finebi-en/doc-view-763.html
Enter this SQL statement in the SQL dataset named Internet_Access_Statistics to retrieve column names for the table.
```SQL
SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name='Internet_Access_Statistics'
```
--------------------------------
### Run Migration Program with chmod and ./lic_remove
Source: https://help.fanruan.com/finebi-en/doc-view-5074.html
These commands are used to run the migration program. First, add executable permissions to the program file, then execute it. After running, a command line window prompts for the server address of the former FineBI project.
```bash
chmod u+x lic_remove
```
```bash
./lic_remove
```
--------------------------------
### ClickHouse Year-Month Interval Filter SQL
Source: https://help.fanruan.com/finebi-en/doc-view-1225.html
Use for filtering by a year-month interval. The start and end year and month parameters are passed as text and combined into YYYY-MM strings for comparison.
```sql
SELECT * FROM _xxxx_ WHERE TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') >=concat('${_Start Year_}',case when cast('${_Start Month_}' as tinyint)>9 then '${_Start Month_}' else concat('0','${_Start Month_}') end ) and TO_CHAR("_Registration Date_ ",'_YYYY-MM_ ') <=concat('${_End Year_}',case when cast('${_End Month_}' as tinyint)>9 then '${_End Month_}' else concat('0','${_End Month_}') end )
```
--------------------------------
### 修改 MySQL 字符集编码并重启服务
Source: https://help.fanruan.com/finebi/doc-view-945.html
修改 my.ini 文件中的字符集键值后重启 MySQL 服务,并查看修改结果。
```ini
default-character-set = utf8
character_set_server = utf8
```
```bash
service mysql restart
```
```sql
mysql> SHOW VARIABLES LIKE 'character%';
```
--------------------------------
### 生成公钥和私钥
Source: https://help.fanruan.com/finebi/doc-view-1075.html
运行 npm run key 生成 publickey 和 privatekey,生成的 key 会输出到 key.txt 文件。
```bash
npm run key
```
--------------------------------
### SELinux:允许 FTP 访问用户主目录
Source: https://help.fanruan.com/finebi/doc-view-1564.html
允许 FTP 服务器访问用户主目录,使用 setsebool 命令设置 ftp_home_dir 布尔值为 1。
```bash
sudo setsebool -P ftp_home_dir 1
```
--------------------------------
### Windows 配置 JVM dump 参数(setenv.bat)
Source: https://help.fanruan.com/finebi/doc-view-570.html?from=help.fanruan.com%2Ffinebi&source=5
在 Windows 的 %Tomcat_HOME%\bin 目录下创建或编辑 setenv.bat 文件,添加 JVM 参数以在内存溢出时自动生成 dump 文件。配置完成后需重启 Tomcat 生效。
```batch
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
set JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=/opt/
```
--------------------------------
### 设置用户 ftpuser 密码
Source: https://help.fanruan.com/finebi/doc-view-1564.html
为用户 ftpuser 设置密码,输入两次密码完成设置。
```bash
sudo passwd ftpuser
```
--------------------------------
### 编辑rc.local配置文件
Source: https://help.fanruan.com/finebi/doc-view-24.html
使用vi编辑器打开/etc/rc.local文件,用于配置开机自启动。
```bash
vi /etc/rc.local
```
--------------------------------
### 加载 Docker 镜像
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 docker load 命令加载镜像文件压缩包。
```bash
docker load -i fine-chat-bi-parser-base_v1_6.tar
```
--------------------------------
### 运行语义解析小模型代码
Source: https://help.fanruan.com/finebi/doc-view-2584.html
在容器内运行 python app.py 启动语义解析小模型服务。
```bash
python app.py
```
--------------------------------
### 重命名webroot为webroot.war
Source: https://help.fanruan.com/finebi/doc-view-655.html
进入webroot.ear目录,将webroot文件夹重命名为webroot.war。
```bash
cd /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/webroot.ear
mv webroot webroot.war
```
--------------------------------
### 建立 login.html 實現 iframe 跨域單點登入
Source: https://help.fanruan.com/finebi-tw/doc-view-534.html
在 FineBI 工程 %BI_HOME%/webapps/webroot/ 目錄下建立 login.html,使用 iframe 指向 FineBI 登入驗證地址,並處理 IE 與其他瀏覽器的 onload 事件以取得 token 並跳轉。需依實際情況修改 URL、帳號、密碼,IP 不可寫 localhost。若使用 HTML5 行動端插件版本 V10.2.0 之前,需帶 __device__=iPhone&terminal=H5 參數;若未註冊行動決策平台功能點,單點登入時會報錯 11100016,需刪除該參數。
```html
```
--------------------------------
### SELinux:允许 FTP 写入文件
Source: https://help.fanruan.com/finebi/doc-view-1564.html
允许 FTP 服务器写入文件,使用 setsebool 命令设置 allow_ftpd_full_access 布尔值为 1。
```bash
sudo setsebool -P allow_ftpd_full_access 1
```
--------------------------------
### SELinux:允许 FTP 使用被动模式端口范围
Source: https://help.fanruan.com/finebi/doc-view-1564.html
允许 FTP 服务器使用指定的被动模式端口范围,需根据实际配置修改端口范围。
```bash
sudo semanage port -a -t ftp_data_port_t -p tcp 50000-50100
```
--------------------------------
### Windows Tomcat 设置 fineIO 写内存
Source: https://help.fanruan.com/finebi/doc-view-1853.html
在 setenv.bat 中添加 -Dfineio.write_mem_limit=1 参数,用于设置堆外 fineIO 写内存为 1G。修改后需重启工程生效。
```batch
set JAVA_OPTS=%JAVA_OPTS% -Dfineio.write_mem_limit=1
```
--------------------------------
### 查看 Docker 镜像
Source: https://help.fanruan.com/finebi/doc-view-2584.html
运行完成后,使用 docker images 检查镜像是否加载成功,出现镜像的名称和版本号即为完成。
```bash
docker images
```
--------------------------------
### 进入FineBI bin目录
Source: https://help.fanruan.com/finebi/doc-view-24.html
进入FineBI安装目录下的bin目录,示例中FineBI安装在/opt目录下。
```bash
cd /opt/FineBI/bin
```
--------------------------------
### 运行 FineAI 容器
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 docker run 命令创建并启动 FineAI 容器,指定端口映射 7666:7666。
```bash
docker run -e TZ=Asia/Shanghai --name fine_ai -p 7666:7666 -it -d fine-ai-base:v0.2 /bin/bash
```
--------------------------------
### Linux Tomcat 设置 fineIO 写内存
Source: https://help.fanruan.com/finebi/doc-view-1853.html
在 setenv.sh 中添加 -Dfineio.write_mem_limit=1 参数,用于设置堆外 fineIO 写内存为 1G。修改后需重启工程生效。
```bash
JAVA_OPTS="$JAVA_OPTS -Dfineio.write_mem_limit=1"
```
--------------------------------
### SELinux:允许 FTP 使用网络
Source: https://help.fanruan.com/finebi/doc-view-1564.html
允许 FTP 服务器使用网络,使用 setsebool 命令设置 ftpd_connect_all_unreserved 布尔值为 1。
```bash
sudo setsebool -P ftpd_connect_all_unreserved 1
```
--------------------------------
### 运行语义解析小模型容器
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 docker run 命令运行镜像,指定时区、容器名称、端口映射等参数。示例端口为 8666。
```bash
docker run -it -e TZ=Asia/Shanghai --name fine-chat-bi-parser-base -d -p 8666:8666 fine-chat-bi-parser-base:v1.6
```
--------------------------------
### Windows Tomcat 设置 fineIO 读内存
Source: https://help.fanruan.com/finebi/doc-view-1853.html
在 setenv.bat 中添加 -Dfineio.read_mem_limit=2 参数,用于设置堆外 fineIO 读内存为 2G。修改后需重启工程生效。
```batch
set JAVA_OPTS=%JAVA_OPTS% -Dfineio.read_mem_limit=2
```
--------------------------------
### 检查容器运行状态
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 docker ps 命令检查容器是否正常运行。
```bash
docker ps
```
--------------------------------
### Linux Tomcat 设置 fineIO 读内存
Source: https://help.fanruan.com/finebi/doc-view-1853.html
在 setenv.sh 中添加 -Dfineio.read_mem_limit=2 参数,用于设置堆外 fineIO 读内存为 2G。修改后需重启工程生效。
```bash
JAVA_OPTS="$JAVA_OPTS -Dfineio.read_mem_limit=2"
```
--------------------------------
### SELinux:临时关闭
Source: https://help.fanruan.com/finebi/doc-view-1564.html
临时将 SELinux 从强制模式切换到宽容模式,无需重启服务器立即生效,但重启后恢复为强制模式。
```bash
sudo setenforce 0
```
--------------------------------
### 复制 FineAI 代码到容器
Source: https://help.fanruan.com/finebi/doc-view-2584.html
将解压后的代码文件复制到容器 fine_ai 的 /root/ 目录。
```bash
docker cp encrypt_fine_ai_xxxxx fine_ai:/root/
```
--------------------------------
### 解压 FineAI 代码包
Source: https://help.fanruan.com/finebi/doc-view-2584.html
使用 tar -xvf 命令解压 FineAI 代码文件。
```bash
tar -xvf encrypt_fine_ai_xxxxx.tar
```
--------------------------------
### 进入镜像上传文件夹
Source: https://help.fanruan.com/finebi/doc-view-2584.html
进入存放镜像文件的文件夹路径,示例路径为 /home/AI。
```bash
cd /home/AI
```
--------------------------------
### Create WEB-INF project storage directory
Source: https://help.fanruan.com/finebi/doc-view-1567.html
Creates the project file storage directory named WEB-INF inside the parent directory.
```bash
mkdir /home/fanruan/WEB-INF/
```
--------------------------------
### vsftpd 配置:允许本地用户写操作
Source: https://help.fanruan.com/finebi/doc-view-1564.html
在 vsftpd 配置文件中启用本地用户写权限,并设置 chroot 相关选项。必须设置 write_enable=YES 以允许上传和创建目录;建议设置 chroot_local_user=YES 限制用户主目录;若主目录可写,需设置 allow_writeable_chroot=YES 避免启动失败。
```ini
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
```
--------------------------------
### 解压webroot.war
Source: https://help.fanruan.com/finebi/doc-view-390.html
在同目录下解压刚打包的war包,用于后续修改配置。
```bash
jar -xvf webroot.war
```
--------------------------------
### CREATE USER for FineBI Oracle configuration library
Source: https://help.fanruan.com/finebi/doc-view-1250.html
新建一个名为 FANRUAN 的 Oracle 用户,密码为 123456,默认表空间为 FINEDB。用户名和表空间命名需符合注意事项:Oracle 12c 用户名需以 C## 为前缀,不支持特殊字符;表空间名称仅允许数字、字母、下划线和点。
```sql
CREATE USER "FANRUAN" IDENTIFIED BY "123456" ACCOUNT UNLOCK DEFAULT TABLESPACE "FINEDB"
```
--------------------------------
### Linux 配置 JVM dump 参数(setenv.sh)
Source: https://help.fanruan.com/finebi/doc-view-570.html?from=help.fanruan.com%2Ffinebi&source=5
在 Linux 的 %Tomcat_HOME%\bin 目录下创建或编辑 setenv.sh 文件,添加 JVM 参数以在内存溢出时自动生成 dump 文件。配置完成后需重启 Tomcat 生效。
```shell
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=/opt/"
```
--------------------------------
### SQL 資料集無參數查詢:select * from 門店維度
Source: https://help.fanruan.com/finebi-tw/doc-view-381.html
用於範例二,建立無參數的 SQL 資料集,以獲取完整的「店號」資料,實現下拉框能選擇所有的店號。
```sql
select * from 門店維度
```
--------------------------------
### 设置目录权限
Source: https://help.fanruan.com/finebi/doc-view-1564.html
确保用户 ftpuser 对目录 /home/ftpuser 有读写执行权限。注:如果考虑安全性,可以只给 755 权限,但是下文拷贝 WEB-INF 文件时务必使用 ftp 用户,否则会因为文件归属问题导致不能写入。
```bash
sudo chmod 777 /home/ftpuser
```
--------------------------------
### 检查服务器下是否有多个容器运行
Source: https://help.fanruan.com/finebi/doc-view-945.html
使用 ps -ef | grep java 检查服务器下是否有多个容器开启了报表工程,若有则需逐一排查对应的 finedb 数据库。
```bash
ps -ef | grep java
```
--------------------------------
### 检查文件
Source: https://help.fanruan.com/finebi/doc-view-2584.html
列出当前目录下的文件,确认镜像文件已上传。
```bash
ls
```
--------------------------------
### 编辑 vsftpd 配置文件
Source: https://help.fanruan.com/finebi/doc-view-1564.html
编辑配置文件 /etc/vsftpd.conf。
```bash
sudo nano /etc/vsftpd.conf
```
--------------------------------
### Docker 基礎鏡像安裝 fontconfig 並重建字體緩存
Source: https://help.fanruan.com/finebi-tw/doc-view-578.html
在 Dockerfile 中執行這些命令,為容器安裝字體管理器並重建字體緩存,以避免匯出 Excel 時出現字體相關的異常。注意:源代碼中的 `fc-cache --forc` 未包含參數,應為 `fc-cache -f` 才算完整命令,但此處保留原文。
```dockerfile
RUN yum -y install fontconfig
RUN fc-cache --forc
```
--------------------------------
### 创建jboss-all.xml
Source: https://help.fanruan.com/finebi/doc-view-390.html
在解压后的META-INF文件夹中新建该文件,内容为JBoss部署配置。
```xml
```
--------------------------------
### Check system architecture with uname -m
Source: https://help.fanruan.com/finebi-tw/doc-view-1593.html
Check the system architecture to ensure it is Linux X64 before downloading the deployment package. The deployment package does not support 32-bit operating systems.
```bash
uname -m
```
--------------------------------
### 进入容器 bash
Source: https://help.fanruan.com/finebi/doc-view-2584.html
进入容器的 /bin/bash 环境,以便执行后续命令。
```bash
docker exec -it fine-chat-bi-parser-base /bin/bash
```
--------------------------------
### 进入 FineAI 容器
Source: https://help.fanruan.com/finebi/doc-view-2584.html
进入容器 fine_ai 的 bash 环境。
```bash
docker exec -it fine_ai /bin/bash
```
--------------------------------
### 新建配置库表空间:CREATE DATABASE finedb COLLATE Chinese_PRC_CS_AS
Source: https://help.fanruan.com/finebi/doc-view-1251.html
标准新建表空间语句,用于创建配置库表空间。建议使用Chinese_PRC_CS_AS排序规则(区分大小写),避免数据迁移时报错。表空间名称只允许包含字母、下划线和「.」,不支持数字。
```sql
CREATE DATABASE finedb COLLATE Chinese_PRC_CS_AS
```
--------------------------------
### Add virtual directory Context in server.xml
Source: https://help.fanruan.com/finebi-tw/doc-view-903.html
Add this Context element between host tags in server.xml to create a virtual directory. path is empty to show the homepage when accessing the IP; docBase points to the moved webroot path.
```xml
```
--------------------------------
### 解压 FineAI 镜像文件
Source: https://help.fanruan.com/finebi/doc-view-2584.html
如果 FineAI 镜像文件以 .gz 结尾,需要先解压。示例命令:gunzip fine-ai-base_v0_1.tar.gz
```bash
gunzip fine-ai-base_v0_1.tar.gz
```
--------------------------------
### 关闭WebSphere工程
Source: https://help.fanruan.com/finebi/doc-view-1322.html
查看WebSphere相关进程,逐一终止,再确认清除。
```bash
ps -ef | grep WebSphere
```
```bash
kill -9
```
```bash
ps -ef | grep WebSphere
```