### DolphinDB 错误码参考 Source: https://github.com/dolphindb/tutorials_cn/blob/master/dolphindb_user_guide.md DolphinDB 提供错误码来标识和处理各种运行错误。 详细的错误代码列表和说明可参考官方文档。 ```APIDOC 参考: [错误代码](https://docs.dolphindb.cn/zh/error_codes/err_codes.html) ``` -------------------------------- ### DolphinDB 日志文件和联系方式 Source: https://github.com/dolphindb/tutorials_cn/blob/master/dolphindb_user_guide.md 在遇到 DolphinDB 使用问题时,可以查看日志文件获取详细信息。每个数据节点和控制节点都有独立的日志文件。 默认日志路径:单节点部署在 server/dolphindb.log,集群部署在 server/log/*.log。 如需进一步帮助,可联系 support@dolphindb.com 或致电 0571-82853925。 ```APIDOC 日志文件位置: - 单节点部署: server/dolphindb.log - 集群部署: server/log/*.log 联系方式: - 邮箱: support@dolphindb.com - 电话: 0571-82853925 ``` -------------------------------- ### DolphinDB 集群节点状态未更新 Source: https://github.com/dolphindb/tutorials_cn/blob/master/dolphindb_user_guide.md 在集群管理器上启动节点后,节点可能仍然显示未启动状态。这通常是由于需要手动刷新集群节点状态。 解决方案是点击集群管理器上的刷新按钮来更新节点状态。 ```APIDOC 问题现象: 集群管理器上启动节点后,节点仍然显示未启动状态。 原因: 需要手动刷新集群节点状态。 解决方案: 点击集群管理器上刷新按钮。 ``` -------------------------------- ### Start DolphinDB Controller and Agent Nodes (Linux) Source: https://github.com/dolphindb/tutorials_cn/blob/master/single_machine_cluster_deploy.md Shell commands to start the DolphinDB controller and agent nodes. The order of starting these two node types does not matter. It also shows how to verify if they are running. ```sh # Start Controller Node sh startController.sh # Start Agent Node sh startagent.sh # Verify node status ps aux|grep dolphindb ``` -------------------------------- ### Starting DolphinDB Cluster Components Source: https://github.com/dolphindb/tutorials_cn/blob/master/ha_cluster_deployment.md Shell commands to start DolphinDB cluster components. This includes making the DolphinDB executable file runnable and then starting the controller and agent nodes. Data and compute nodes can be managed via the Web UI. ```shell # Make DolphinDB executable chmod +x dolphindb # Start Controller Node (run on each controller server) sh startController.sh # Start Agent Node (run on each agent server) sh startagent.sh # Check if nodes are running ps aux|grep dolphindb ``` -------------------------------- ### DolphinDB Cluster Deployment Source: https://github.com/dolphindb/tutorials_cn/blob/master/dolphindb_user_guide.md Guides for deploying DolphinDB in various cluster configurations, including single-node, single-machine cluster, and multi-server cluster setups. High availability options are also discussed. ```APIDOC DolphinDB Cluster Deployment Scenarios: 1. Standalone Server (Single Node Mode): - Description: Use as an independent workstation or server. No configuration needed after download. - Reference: [Standalone Server Deployment Tutorial](./standalone_server.md) - ARM Version: [ARM Version Standalone Deploy Tutorial](./ARM_standalone_deploy.md) - Features: Same as cluster mode but lacks node expansion and high availability. 2. Single Machine Cluster Deployment: - Description: Controller, agent, data node, and compute node deployed on the same physical machine. - Reference: [Single Machine Cluster Deployment](./single_machine_cluster_deploy.md) 3. Multi-Server Cluster Deployment: - Description: Deploy DolphinDB cluster across multiple physical machines. - Reference: [Multi-Server Cluster Deployment](./multi_machine_cluster_deployment.md) 4. High Availability Cluster Deployment: - Description: Provides high availability for data, metadata, and clients to ensure continuous operation during node failures. - Reference: [High Availability Cluster Deployment](./ha_cluster_deployment.md) ``` -------------------------------- ### Initialize MQTT and Environment Source: https://github.com/dolphindb/tutorials_cn/blob/master/data/DolphinDB_streaming_application_in_IOT/deviceState.txt Logs into DolphinDB, loads the MQTT plugin, and clears the existing environment by unsubscribing from tables and dropping related engines and subscriptions. ```dolphindb login(`admin,`123456) try{loadPlugin(getHomeDir()+"/plugins/mqtt/PluginMQTTClient.txt")} catch(ex) {print(ex)} go use mqtt; ``` ```dolphindb def clearEnv(){ try{ unsubscribeTable( tableName=`inputSt, actionName="monitor") if(objs(true).name.find('inputSt')!=-1) dropStreamTable(`inputSt) if(objs(true).name.find('outputSt1')!=-1) dropStreamTable(`outputSt1) if(objs(true).name.find('outputSt2')!=-1) dropStreamTable(`outputSt2) if (getAggregatorStat().ReactiveStreamEngine[`name].find(`reactivEngine)!=-1) dropAggregator(`reactivEngine) if (getAggregatorStat().SessionWindowEngine[`name].find(`swEngine)!=-1) dropAggregator(`swEngine) for (id in mqtt::getSubscriberStat()[`subscriptionId]) mqtt::unsubscribe(id) }catch(ex){ print(ex) } } ``` -------------------------------- ### DolphinDB Core Functionality and Examples Source: https://github.com/dolphindb/tutorials_cn/blob/master/README.md This section provides introductory materials and examples for getting started with DolphinDB, including quant finance and IoT use cases. It also covers dynamic field additions and metric calculations. ```DolphinDB ## DolphinDB Core Functionality and Examples This section covers introductory materials and core functionalities. ### Getting Started with DolphinDB - **DolphinDB Getting Started: Quant Finance Examples**: Introductory examples for quantitative finance applications. - **DolphinDB Getting Started: IoT Examples**: Introductory examples for Internet of Things applications. ### Dynamic Field Addition and Metric Calculation - **Dynamically Adding Fields and Calculating Metrics**: Guides on modifying table schemas and computing metrics on the fly. ``` -------------------------------- ### Start DolphinDB Server (Linux) Source: https://github.com/dolphindb/tutorials_cn/blob/master/best_implementation_for_NSQ_Plugin.md Starts the DolphinDB server in console mode on Linux. The output is redirected to a log file, and the process runs in the background. This command should be executed from the DolphinDB server installation directory. ```Shell nohup ./dolphindb -console 0 > single.nohup 2>&1 & ``` -------------------------------- ### 命令行远程脚本执行 Source: https://github.com/dolphindb/tutorials_cn/blob/master/client_tool_tutorial.md 通过在启动 DolphinDB 终端命令中添加 `-run` 参数,可以指定一个本地脚本文件在远程服务器上执行,执行完成后终端自动退出。 ```DolphinDB ./dolphindb -remoteHost 127.0.0.1 -remotePort 8848 -uid admin -pwd 123456 -run /home/usr1/test.dos ``` -------------------------------- ### Install Miniconda on Linux Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Downloads and installs the latest Miniconda for Linux. After installation, it activates the base environment. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh sh Miniconda3-latest-Linux-x86_64.sh source ~/.bashrc ``` -------------------------------- ### Install and Start Grafana Source: https://github.com/dolphindb/tutorials_cn/blob/master/DolphinDB_Telegraf_Grafana.md Installs the Grafana enterprise version, starts the Grafana server, and opens the default port 3000 in the firewall for access. ```shell wget https://dl.grafana.com/enterprise/release/grafana-enterprise-9.3.2-1.x86_64.rpm sudo yum install grafana-enterprise-9.3.2-1.x86_64.rpm systemctl start grafana-server systemctl enable grafana-server firewall-cmd --zone=public --add-port=3000/tcp --permanent firewall-cmd --reload ``` -------------------------------- ### DolphinDB 多句提交 Source: https://github.com/dolphindb/tutorials_cn/blob/master/client_tool_tutorial.md 在 DolphinDB 终端中,可以提交包含函数定义和调用的多行脚本。通过在代码块末尾添加分号 `;` 或 `go` 语句来触发执行。 ```DolphinDB def myFunc(x,y){ return x+y } myFunc(1,2); ``` -------------------------------- ### 安装 DolphinDB INSIGHT 插件 Source: https://github.com/dolphindb/tutorials_cn/blob/master/insight_plugin.md 执行 `installPlugin` 函数来下载与当前 DolphinDB server 版本适配的 INSIGHT 插件文件。该函数会从远程文件服务器拉取插件到 DolphinDB server 所在的服务器,可能需要一分钟时间。 ```DolphinDB login("admin", "123456") installPlugin("insight") ``` -------------------------------- ### List Installed Python Packages Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Displays a list of all Python packages currently installed in the environment, along with their versions. This is useful for verifying installations. ```bash C:\pythonApi>pip list Package Version --------------- --------- dolphindb 1.30.19.2 future 0.18.2 numpy 1.22.3 pandas 1.5.1 pip 21.1.1 python-dateutil 2.8.2 pytz 2022.6 setuptools 56.0.0 six 1.16.0 ``` -------------------------------- ### DolphinDB 节点配置文件预加载插件 Source: https://github.com/dolphindb/tutorials_cn/blob/master/iot_examples.md 在 DolphinDB 节点配置文件中通过 `preloadModules` 参数预加载 OPC UA 和 MQTT 插件,以便在脚本中直接使用这些插件的功能,无需每次都调用 `loadPlugin`。 ```dolphindb preloadModules=plugins::opc,plugins::mqtt ``` -------------------------------- ### Verify pip package installation (Linux) Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Lists all installed Python packages in the current environment to verify the successful installation of DolphinDB and its dependencies. ```bash pip list ``` -------------------------------- ### Troubleshooting Pip Wheel Installation Error Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Resolves the 'invalid command 'bdist_wheel'' error during pip installation by ensuring the 'wheel' package is installed. ```bash error: invalid command 'bdist_wheel' A: 使用 pip 安装 wheel pip install wheel ``` -------------------------------- ### 节点启动时自动订阅 AMD 行情数据 Source: https://github.com/dolphindb/tutorials_cn/blob/master/best_implementation_for_AMD_Plugin.md 通过配置 DolphinDB 节点的 `startup.dos` 文件,可以实现节点启动时自动订阅 AMD 实时行情数据并入库。单节点模式下配置在 `dolphindb.cfg`,集群模式下配置在 `cluster.cfg`。 ```config startup=/DolphinDB/server/startup.dos ``` -------------------------------- ### 配置项预加载插件 Source: https://github.com/dolphindb/tutorials_cn/blob/master/Startup.md 此配置展示了如何在 DolphinDB 的配置文件(dolphindb.cfg 或 cluster.cfg)中通过 `preloadModules` 参数预加载 ODBC 插件,实现与在启动脚本中加载插件相同的功能。 ```APIDOC preloadModules=plugins::odbc ``` -------------------------------- ### Install Python Packages from Requirements File Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Installs multiple Python packages listed in a requirements.txt file, typically used for offline installations where all necessary wheel files are present. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install DolphinDB Python API using WHL Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Installs the DolphinDB Python API from a downloaded .whl file using pip. This is the final step for installing the API in an offline environment. ```python pip install dolphindb-1.30.19.2-cp38-cp38-manylinux2010_x86_64.whl ``` -------------------------------- ### 在线更新授权文件失败的解决方案 Source: https://github.com/dolphindb/tutorials_cn/blob/master/standalone_server.md 如果 DolphinDB 在线更新授权文件失败,通常是因为不满足在线更新的要求。用户可以尝试离线更新授权文件,或申请企业版 License。 ```zh 在线更新授权文件需要满足[更新授权许可文件](#第二步更新授权许可文件)中在线更新的要求。如果不满足其中的要求,可以通过离线方式进行更新,或申请[企业版 License](https://dolphindb.cn/product#downloads)。 ``` -------------------------------- ### Create DolphinDB Database and Table Source: https://github.com/dolphindb/tutorials_cn/blob/master/script/streaming_capital_flow_order_by_order/01.创建存储历史数据的库表并导入数据.txt This script demonstrates how to create a DolphinDB database with specific partitioning schemes (VALUE and HASH) and then create a partitioned table with a defined schema. It includes logic to drop the database if it already exists and specifies compression methods for partitions. ```dolphindb csvDataPath = "/hdd/hdd9/data/streaming_capital_flow/20200102_SH_trade.csv" dbName = "dfs://trade" tbName = "trade" //login account login("admin", "123456") //create database and table if(existsDatabase(dbName)){ dropDatabase(dbName) } db1 = database(, VALUE, 2020.01.01..2022.01.01) db2 = database(, HASH, [SYMBOL, 5]) db = database(dbName, COMPO, [db1, db2]) schemaTable = table( array(SYMBOL, 0) as SecurityID, array(SYMBOL, 0) as Market, array(TIMESTAMP, 0) as TradeTime, array(DOUBLE, 0) as TradePrice, array(INT, 0) as TradeQty, array(DOUBLE, 0) as TradeAmount, array(INT, 0) as BuyNum, array(INT, 0) as SellNum ) db.createPartitionedTable(table=schemaTable, tableName=tbName, partitionColumns=`TradeTime`SecurityID, compressMethods={TradeTime:"delta"}) go ``` -------------------------------- ### Verify DolphinDB Python API installation (Linux) Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Imports the DolphinDB session object in Python to confirm that the API is installed correctly and can be initialized. ```python import dolphindb as ddb s = ddb.session() s ``` -------------------------------- ### Environment Cleanup and Setup Source: https://github.com/dolphindb/tutorials_cn/blob/master/script/machine_learning_volatility/04.streamComputing.txt This script defines and executes a function to clean up existing DolphinDB stream computing resources and then logs in to the DolphinDB server. ```dolphindb def cleanEnvironment(){ try{ unsubscribeTable(tableName=`snapshotStream, actionName="aggrFeatures10min") } catch(ex){ print(ex) } try{ unsubscribeTable(tableName=`aggrFeatures10min, actionName="predictRV") } catch(ex){ print(ex) } try{ dropStreamEngine("aggrFeatures10min") } catch(ex){ print(ex) } try{ dropStreamTable(`snapshotStream) } catch(ex){ print(ex) } try{ dropStreamTable(`aggrFeatures10min) } catch(ex){ print(ex) } try{ dropStreamTable(`result1min) } catch(ex){ print(ex) } undef all } cleanEnvironment() go //login account login("admin", "123456") ``` -------------------------------- ### Troubleshooting Conda Offline Installation Missing Packages Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Addresses the 'PackagesNotFoundError' when installing packages offline with Conda, suggesting to check and correct the 'pkgs_dirs' configuration. ```bash PackagesNotFoundError: The following packages are not available from current channels: - pandas - python=3.8.13 - numpy A: 检查下 `pkgs_dirs ` 是否设置正确,以及在该目录下是否有提示信息中的包。不能有任何中间目录,例如设置 conda 的包目录为 pkgs,那么 pkgs/pkgs/numpy 是无法被 conda 找到的。 ``` -------------------------------- ### 配置 DolphinDB 用户启动脚本 Source: https://github.com/dolphindb/tutorials_cn/blob/master/insight_plugin.md 通过配置 `startup` 参数指向用户启动脚本文件(如 startup.dos),可以在 DolphinDB 节点启动时执行自定义脚本。此脚本可用于部署自动订阅等任务。配置可以是绝对路径或相对路径。 ```dos startup=/DolphinDB/server/startup.dos ``` -------------------------------- ### Verify DolphinDB Python API Installation Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Imports the DolphinDB library and creates a session object to verify that the Python API has been successfully installed and is functional. ```python >>> import dolphindb as ddb >>> s = ddb.session() >>> s ``` -------------------------------- ### 启动集群节点(Windows 批处理) Source: https://github.com/dolphindb/tutorials_cn/blob/master/single_machine_cluster_deploy.md 此代码块提供了在 Windows 操作系统上启动 DolphinDB 集群节点的批处理命令。它包含了启动控制节点 (`startController.bat`)、代理节点 (`startAgent.bat`) 的前台和后台启动方式。此外,还说明了如何通过 Web 管理界面启动和管理数据节点和计算节点。 ```batch :: 前台启动控制节点和代理节点 startController.bat startAgent.bat :: 后台启动控制节点和代理节点 backgroundStartController.vbs backgroundStartAgent.vbs ``` -------------------------------- ### Start DolphinDB Agent Node Source: https://github.com/dolphindb/tutorials_cn/blob/master/deploy_dolphindb_on_new_server.md Executes the script to start a DolphinDB agent node. Ensure you are in the DolphinDB installation directory. ```console cd DolphinDB/clusterDemo/ ./startAgent.sh ``` -------------------------------- ### Start DolphinDB Controller Node Source: https://github.com/dolphindb/tutorials_cn/blob/master/deploy_dolphindb_on_new_server.md Executes the script to start a DolphinDB controller node. Ensure you are in the DolphinDB installation directory. ```console cd DolphinDB/clusterDemo/ ./startController.sh ``` -------------------------------- ### Environment Initialization and Table Creation Execution Source: https://github.com/dolphindb/tutorials_cn/blob/master/script/Real-Time_Stock_Price_Increase_Calculation/02.清理环境并创建相关流数据表.txt This snippet demonstrates the execution flow by first calling `cleanEnvironment` to prepare the system, then defining the database and table names for snapshot data, and finally calling `createStreamTable` to set up the necessary stream tables. ```dolphindb cleanEnvironment() dbName, tbName = "dfs://SH_TSDB_snapshot_ArrayVector", "snapshot" createStreamTable(dbName, tbName) ``` -------------------------------- ### Offline Installation of DolphinDB and Dependencies Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Demonstrates the output of pip installing various wheel packages, including DolphinDB, numpy, pandas, and their dependencies, in an offline environment. ```bash D:\pythonApi>pip install -r requirements.txt Processing d:\pythonapi\dolphindb-1.30.19.2-cp38-cp38-win_amd64.whl Processing d:\pythonapi\numpy-1.22.3-cp38-cp38-win_amd64.whl Processing d:\pythonapi\pandas-1.5.1-cp38-cp38-win_amd64.whl Processing d:\pythonapi\python_dateutil-2.8.2-py2.py3-none-any.whl Processing d:\pythonapi\pytz-2022.6-py2.py3-none-any.whl Processing d:\pythonapi\six-1.16.0-py2.py3-none-any.whl Collecting future==0.18.2 Using cached future-0.18.2-py3-none-any.whl Installing collected packages: six, pytz, python-dateutil, numpy, pandas, future, dolphindb Successfully installed dolphindb-1.30.19.2 future-0.18.2 numpy-1.22.3 pandas-1.5.1 python-dateutil-2.8.2 pytz-2022.6 six-1.16.0 ``` -------------------------------- ### 配置参数调优参考 Source: https://github.com/dolphindb/tutorials_cn/blob/master/standalone_server.md DolphinDB 提供了官方的参数配置说明,用户可以参考该文档进行配置参数调优以优化性能。遇到性能问题时,可以通过提供的联系方式寻求技术支持。 ```zh 可以参考 DolphinDB 官方参数配置说明进行配置参数调优:[参数配置](https://docs.dolphindb.com/zh/db_distr_comp/cfg/para_cfg.html)。 如果遇到性能问题,请添加微信号 13306510479(仅用于添加微信)或扫描下面二维码,客服会邀您进群,由 DolphinDB 的技术支持工程师会解答您的问题。 ![singlenode_techsupport_qr](images/deploy_standalone/singlenode_techsupport_qr.png) ``` -------------------------------- ### Install DolphinDB wheel package (Windows Offline) Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Installs the DolphinDB Python API from a specific .whl file designed for Windows x86_64 with Python 3.8. ```cmd pip install dolphindb-1.30.19.2-cp38-cp38-win_amd64.whl ``` -------------------------------- ### Environment Cleanup and Setup Source: https://github.com/dolphindb/tutorials_cn/blob/master/script/machine_learning_volatility/06.streamComputingReproduction.txt Cleans up existing stream engines and tables, then logs in and defines paths for model and data. It also initializes necessary stream tables for snapshot data, aggregated features, and prediction results. ```dolphindb def cleanEnvironment(){ try{ unsubscribeTable(tableName=`snapshotStream, actionName="aggrFeatures10min") } catch(ex){ print(ex) } try{ unsubscribeTable(tableName=`aggrFeatures10min, actionName="predictRV") } catch(ex){ print(ex) } try{ dropStreamEngine("aggrFeatures10min") } catch(ex){ print(ex) } try{ dropStreamTable(`snapshotStream) } catch(ex){ print(ex) } try{ dropStreamTable(`aggrFeatures10min) } catch(ex){ print(ex) } try{ dropStreamTable(`result1min) } catch(ex){ print(ex) } undef all } cleanEnvironment() go login("admin", "123456") modelSavePath = "/hdd/hdd9/machineLearning/realizedVolatilityModel_1.30.18.bin" csvDataPath = "/hdd/hdd9/machineLearning/testSnapshot.csv" model = loadModel(modelSavePath) name = `SecurityID`TradeTime`PreClosePx`OpenPx`HighPx`LowPx`LastPx`TotalVolumeTrade`TotalValueTrade`BidPrice0`BidPrice1`BidPrice2`BidPrice3`BidPrice4`BidPrice5`BidPrice6`BidPrice7`BidPrice8`BidPrice9`BidOrderQty0`BidOrderQty1`BidOrderQty2`BidOrderQty3`BidOrderQty4`BidOrderQty5`BidOrderQty6`BidOrderQty7`BidOrderQty8`BidOrderQty9`OfferPrice0`OfferPrice1`OfferPrice2`OfferPrice3`OfferPrice4`OfferPrice5`OfferPrice6`OfferPrice7`OfferPrice8`OfferPrice9`OfferOrderQty0`OfferOrderQty1`OfferOrderQty2`OfferOrderQty3`OfferOrderQty4`OfferOrderQty5`OfferOrderQty6`OfferOrderQty7`OfferOrderQty8`OfferOrderQty9 type =`SYMBOL`TIMESTAMP`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`INT`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`INT`INT`INT`INT`INT`INT`INT`INT`INT`INT`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`INT`INT`INT`INT`INT`INT`INT`INT`INT`INT share streamTable(100000:0, name, type) as snapshotStream share streamTable(100000:0 , `TradeTime`SecurityID`BAS`DI0`DI1`DI2`DI3`DI4`DI5`DI6`DI7`DI8`DI9`Press`RV,`TIMESTAMP`SYMBOL`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE`DOUBLE) as aggrFeatures10min share streamTable(100000:0 , `TradeTime`SecurityID`PredictRV`CostTime, `TIMESTAMP`SYMBOL`DOUBLE`INT) as result1min go ``` -------------------------------- ### Verify DolphinDB Python API installation and connection (Windows) Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Connects to a DolphinDB server using the installed Python API and executes a simple command to verify the connection and functionality. ```python import dolphindb as ddb s = ddb.session() s.connect("192.168.1.157", 8848, "admin", "123456") s.run("print(\"Welcome to DolphinDB!\")") s.close() ``` -------------------------------- ### Main Execution Block Source: https://github.com/dolphindb/tutorials_cn/blob/master/script/csvImportDemo/importNewData.txt Sets up database connection parameters, file paths, and schema, then initiates the data loading process by calling `loopLoadOneYearFiles`. ```dolphindb dbName = "dfs://stocks_orderbook" tableName = "orderBook" filePath="/hdd/hdd9/data/quotes/2020" csv="/hdd/hdd9/data/quotes/2020/20200102/SH501000.csv" schema1=getSchema(csv) loopLoadOneYearFiles(dbName,tableName, filePath,schema1) ``` -------------------------------- ### Troubleshooting DolphinDB Python API Installation Mismatch Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Guides users on how to resolve 'Could not find a version that satisfies the requirement dolphindb' errors by ensuring the wheel package is compatible with the system architecture and Python version, including renaming the wheel file if necessary. ```bash ERROR: Could not find a version that satisfies the requirement dolphindb (from versions: none) A: 安装环境与 whl 包不匹配导致。可以按如下步骤处理: 1. 通过 [PyPI](https://pypi.org/) 确认是否存在支持当前操作系统(例如 Linux ARM 架构、Mac M1等)的 DolphinDB API 安装包。若存在,则将该 whl 包下载至本地。 2. 通过如下命令查看适合当前系统环境支持的 whl 包后缀。 ``` pip debug --verbose ``` 3. 根据 Compatible tags 的显示信息,将 DolphinDB 的 whl 包名修改为适合系统架构的名称。以 Mac(x86_64) 系统为例:安装包名为“dolphindb-1.30.19.2-cp37-cp37m-macosx_10_16_x86_64.whl”。但查询到 pip 支持的当前系统版本为10.13,则使用“10_13”替换 whl 包名中的“10_16”。 4. 尝试安装更名后的 whl 包。 若执行完上述操作后,仍无法安装或导入,可在 [DolphinDB 社区](https://ask.dolphindb.net/) 中进行反馈。 ``` -------------------------------- ### Start Grafana Server Source: https://github.com/dolphindb/tutorials_cn/blob/master/cluster_monitor.md Starts the Grafana server. The executable is typically found in the 'bin' directory of the Grafana installation. Grafana runs as a background process. ```shell $ nohup ./grafana-server web & ``` -------------------------------- ### 创建新的 /home 逻辑卷并格式化为 xfs Source: https://github.com/dolphindb/tutorials_cn/blob/master/deploy_dolphindb_on_new_server.md 创建一个新的逻辑卷用于 /home 目录,并将其格式化为 xfs 文件系统。 ```console # lvcreate -L 41G -n home centos # 根据剩余可用空间填写创建大小 WARNING: xfs signature detected on /dev/centos/home at offset 0. Wipe it? [y/n]: y Wiping xfs signature on /dev/centos/home. Logical volume "home" created. # mkfs.xfs /dev/mapper/centos-home ``` -------------------------------- ### Main Execution Flow Source: https://github.com/dolphindb/tutorials_cn/blob/master/data/DolphinDB_streaming_application_in_IOT/deviceState.txt Orchestrates the entire process by clearing the environment, creating necessary tables, setting up data consumption, subscribing to an MQTT topic, and submitting a job to publish table data. ```dolphindb def main(){ clearEnv() createInOutTable() consume() host="127.0.0.1" port=1883 topic="sensor/test" writeStreamTable(host, port, topic) t t=loadText(getHomeDir()+"/deviceState.csv") //myFormat=take("", 3) f= mqtt::createCsvFormatter(myFormat, ',', ';') f = createJsonFormatter() batchsize=100 submitJob("submit_pub1", "submit_p1", publishTableData{host,topic,f, batchsize,t}) } main() ``` -------------------------------- ### Install unixODBC on Linux Source: https://github.com/dolphindb/tutorials_cn/blob/master/ODBC_plugin_user_guide.md Provides commands for installing the unixODBC package on CentOS and Ubuntu systems, which is essential for ODBC driver management. ```Shell //CentOS 系统 yum install unixODBC yum install unixODBC-devel.x86_64 //ubuntu 系统 apt-get install unixodbc apt-get install unixodbc-dev ``` -------------------------------- ### DolphinDB 单句提交 Source: https://github.com/dolphindb/tutorials_cn/blob/master/client_tool_tutorial.md 在 DolphinDB 终端中,可以通过在代码末尾添加分号 `;` 来提交单行代码到远程服务器执行。 ```DolphinDB 1+2; ``` -------------------------------- ### 卸载并删除 /home 逻辑卷 Source: https://github.com/dolphindb/tutorials_cn/blob/master/deploy_dolphindb_on_new_server.md 卸载 /home 分区并删除对应的逻辑卷,为重新创建 xfs 文件系统做准备。 ```console # umount /home # lvremove /dev/mapper/centos-home Do you really want to remove active logical volume centos/home? [y/n]: y Logical volume "home" successfully removed ``` -------------------------------- ### 挂载 /home 并恢复数据 Source: https://github.com/dolphindb/tutorials_cn/blob/master/deploy_dolphindb_on_new_server.md 挂载新创建的 /home 逻辑卷,并将之前备份的数据恢复到新目录,同时修正文件权限。 ```console # mount /dev/mapper/centos-home /home # mv /tmp/home/* /home/ # chown owner /home/owner # 重新赋予 home 目录文件的权限给对应 owner,需要根据用户名自行修改 ``` -------------------------------- ### Install DolphinDB wheel package (Linux Offline) Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Installs DolphinDB and its dependencies from local .whl files in an offline Linux environment. This command assumes all necessary .whl files are present in the current directory. ```bash pip install *.whl ``` -------------------------------- ### Starting Jupyter Notebook Source: https://github.com/dolphindb/tutorials_cn/blob/master/client_tool_tutorial.md Shell command to launch the Jupyter Notebook application. ```Shell jupyter notebook ``` -------------------------------- ### Generate requirements.txt for DolphinDB Source: https://github.com/dolphindb/tutorials_cn/blob/master/python_api_install_offline.md Installs DolphinDB and then uses 'pip freeze' to capture all its dependencies into a requirements.txt file, useful for replicating the environment. ```bash pip install dolphindb -i https://pypi.tuna.tsinghua.edu.cn/simple pip freeze dolphindb > requirements.txt ``` -------------------------------- ### 在 DolphinDB 节点上加载插件 Source: https://github.com/dolphindb/tutorials_cn/blob/master/plugin_development_tutorial.md 此脚本用于在 DolphinDB 的所有数据节点上加载指定的插件。它利用 `each` 和 `rpc` 函数将 `loadPlugin` 函数远程执行到每个数据节点。 ```dolphindb each(rpc{, loadPlugin, pathToPlugin}, getDataNodes()) ``` -------------------------------- ### DolphinDB API Integration Source: https://github.com/dolphindb/tutorials_cn/blob/master/dolphindb_user_guide.md DolphinDB provides development interfaces for Java, Python, and C#. Refer to the user manual for installation steps and usage details. ```APIDOC DolphinDB API Integration: - Python API: For Python integration. - Java API: For Java integration. - C# API: For C# integration. Refer to user manual for installation and usage: https://docs.dolphindb.cn/zh/api/connapi_intro.html ```