From 5a8591aaf04bc31576abfdd30ab9c19a88117fc9 Mon Sep 17 00:00:00 2001 From: Mingyu Chen Date: Wed, 24 Nov 2021 10:42:33 +0800 Subject: [PATCH] [doc] add FAQ document (#7173) From Apache Doris wechat count, authorized. --- docs/.vuepress/sidebar/en.js | 7 + docs/.vuepress/sidebar/zh-CN.js | 7 + docs/en/developer-guide/minidump.md | 6 +- docs/en/faq/faq.md | 271 +++++++++++++++++++++++++ docs/zh-CN/developer-guide/minidump.md | 6 +- docs/zh-CN/faq/faq.md | 271 +++++++++++++++++++++++++ 6 files changed, 562 insertions(+), 6 deletions(-) create mode 100644 docs/en/faq/faq.md create mode 100644 docs/zh-CN/faq/faq.md diff --git a/docs/.vuepress/sidebar/en.js b/docs/.vuepress/sidebar/en.js index 0322ba48d3..57de65e4cf 100644 --- a/docs/.vuepress/sidebar/en.js +++ b/docs/.vuepress/sidebar/en.js @@ -636,6 +636,13 @@ module.exports = [ "minidump" ], }, + { + title: "FAQ", + directoryPath: "faq/", + children: [ + "faq" + ], + }, { title: "Apache Community", directoryPath: "community/", diff --git a/docs/.vuepress/sidebar/zh-CN.js b/docs/.vuepress/sidebar/zh-CN.js index d38a86603a..88688d87a0 100644 --- a/docs/.vuepress/sidebar/zh-CN.js +++ b/docs/.vuepress/sidebar/zh-CN.js @@ -640,6 +640,13 @@ module.exports = [ "minidump" ], }, + { + title: "FAQ 常见问题", + directoryPath: "faq/", + children: [ + "faq" + ], + }, { title: "Apache 社区", directoryPath: "community/", diff --git a/docs/en/developer-guide/minidump.md b/docs/en/developer-guide/minidump.md index 8b9a5281eb..aef0a1fb41 100644 --- a/docs/en/developer-guide/minidump.md +++ b/docs/en/developer-guide/minidump.md @@ -62,9 +62,9 @@ There are two ways to generate Minidump: ``` Minidump created at: /doris/be/Minidump/4f8d4fe5-15f8-40a3-843109b3-d49993f3.dmp -*** Aborted at 1636970042 (unix time) try "date -d @1636970042" if you are using GNU date *** -PC: @ 0x1b184e4 doris::OlapScanNode::scanner_thread() -*** SIGSEGV (@0x0) received by PID 71567 (TID 0x7f173a5df700) from PID 0; stack trace: *** + *** Aborted at 1636970042 (unix time) try "date -d @1636970042" if you are using GNU date *** + PC: @ 0x1b184e4 doris::OlapScanNode::scanner_thread() + *** SIGSEGV (@0x0) received by PID 71567 (TID 0x7f173a5df700) from PID 0; stack trace: *** @ 0x220c992 google::(anonymous namespace)::FailureSignalHandler() @ 0x7f174fb5e1d0 (unknown) @ 0x1b184e4 doris::OlapScanNode::scanner_thread() diff --git a/docs/en/faq/faq.md b/docs/en/faq/faq.md new file mode 100644 index 0000000000..3349a9e9a0 --- /dev/null +++ b/docs/en/faq/faq.md @@ -0,0 +1,271 @@ +--- +{ + "title": "FAQ", + "language": "en" +} +--- + + + +# FAQ + +This document is mainly used to record common problems in the use of Doris. Will be updated from time to time. + +### Q1. Use Stream Load to access the public network address of FE to import data, and it is redirected to the internal network IP? + + +When the connection target of stream load is the http port of FE, FE will only randomly select a BE node for http 307 redirect operation, so the user's request is actually sent to a BE designated by FE. The redirect returns the ip of BE, which is the intranet IP. So if you send the request through the public IP of FE, it is very likely that you will not be able to connect because you are redirected to the intranet address. + +The usual approach is to ensure that you can access the intranet IP address, or assume a load balance for all BE upper layers, and then directly send the stream load request to the load balancer, and the load balancer transparently transmits the request to the BE node . + +### Q2. Query error: Failed to get scan range, no queryable replica found in tablet: xxxx + +This situation is because the corresponding tablet does not find a copy that can be queried, usually because the BE is down, the copy is missing, and so on. You can use the `show tablet tablet_id` statement first, and then execute the following `show proc` statement to view the copy information corresponding to this tablet, and check whether the copy is complete. At the same time, you can use the `show proc "/cluster_balance"` information to query the progress of replica scheduling and repair in the cluster. + +For commands related to data copy management, please refer to [Data Copy Management](../administrator-guide/operation/tablet-repair-and-balance.md). + +### Q3. FE failed to start, fe.log keeps scrolling "wait catalog to be ready. FE type UNKNOWN" + +There are usually two reasons for this problem: + +1. The local IP obtained when the FE is started this time is inconsistent with the last time, usually because the `priority_network` is not set correctly, the wrong IP address is matched when the FE is started. Need to modify `priority_network` and restart FE. + +2. Most Follower FE nodes in the cluster are not started. For example, there are 3 Followers and only one is started. At this time, at least one other FE needs to be also activated, and the FE electable group can elect the Master to provide services. + +If none of the above conditions can be resolved, you can follow the [Metadata Operation and Maintenance Document] (../administrator-guide/operation/metadata-operation.md) in the Doris official website to restore. + +### Q4. When the BE node is offline through DECOMMISSION, why is there always some tablet remaining? + +During the offline process, check the tabletNum of the offline node through show backends, and you will observe that the number of tabletNum is decreasing, indicating that the data fragments are migrating from this node. When the number is reduced to 0, the system will automatically delete this node. But in some cases, tabletNum does not change after it drops to a certain value. This can usually have the following two reasons: + +1. These tablets belong to the table, partition, or materialized view that has just been deleted. The objects that have just been deleted will remain in the recycle bin. The offline logic will not process these fragments. You can modify the resident time of the object in the recycle bin by modifying the configuration parameter catalog_trash_expire_second of FE. When the object is deleted from the recycle bin, these tablets will be processed. + +2. There is a problem with the migration task of these tablets. At this time, you need to check the error of the specific task through show proc "/cluster_balance". + +For the above situation, you can first check whether the cluster still has unhealthy shards through show proc "/statistic". If it is 0, you can delete the BE directly through the drop backend statement. Otherwise, you need to check the copy status of unhealthy shards. + + +### Q5. How should priorty_network be set? + +Priorty_network is a configuration parameter for both FE and BE. This parameter is mainly used to help the system choose the correct network card IP as its own IP. It is recommended to set this parameter explicitly under any circumstances to prevent the problem of incorrect IP selection caused by the addition of a new network card to the subsequent machine. + +The value of priorty_network is expressed in CIDR format. It is divided into two parts, the first part is a dotted decimal IP address, and the second part is a prefix length. For example, 10.168.1.0/8 will match all 10.xx.xx.xx IP addresses, and 10.168.1.0/16 will match all 10.168.xx.xx IP addresses. + +The reason for using the CIDR format instead of directly specifying a specific IP is to ensure that all nodes can use uniform configuration values. For example, there are two nodes: 10.168.10.1 and 10.168.10.2, then we can use 10.168.10.0/24 as the value of priorty_network. + +### Q6. What are FE's Master, Follower and Observer? + +First of all, make it clear that FE has only two roles: Follower and Observer. The Master is just an FE selected from a group of Follower nodes. Master can be regarded as a special kind of Follower. So when we were asked how many FEs in a cluster and what roles are they, the correct answer should be the number of all FE nodes, the number of Follower roles, and the number of Observer roles. + +All FE nodes in the Follower role will form a selectable group, similar to the group concept in the Poxas consensus protocol. A Follower will be elected as the Master in the group. When the Master hangs up, the new Follower will be automatically selected as the Master. Observer will not participate in the election, so Observer will not be called Master. + +A metadata log needs to be successfully written in most Follower nodes to be considered successful. For example, if 3 FEs are written, 2 writes are successful. This is why the number of Follower roles needs to be an odd number. + +The role of Observer is the same as the meaning of this word. It only acts as an observer to synchronize the metadata logs that have been successfully written, and provides metadata reading services. He will not participate in the logic of majority writing. + +Normally, you can deploy 1 Follower + 2 Observer or 3 Follower + N Observer. The former is simple to operate and maintain, and there will be almost no consensus agreement between Followers to cause this complicated error situation (most of Baidu's internal clusters use this method). The latter can ensure the high availability of metadata writing. If it is a high-concurrency query scenario, you can appropriately increase the Observer. + +### Q7. tablet writer write failed, tablet_id=27306172, txn_id=28573520, err=-235 or -215 or -238 + +This error usually occurs during data import operations. The error code of the new version is -235, and the error code of the old version may be -215. The meaning of this error is that the data version of the corresponding tablet exceeds the maximum limit (default 500, controlled by the BE parameter `max_tablet_version_num`), and subsequent writes will be rejected. For example, the error in the question means that the data version of the tablet 27306172 exceeds the limit. + +This error is usually because the import frequency is too high, which is greater than the compaction speed of the background data, which causes the version to accumulate and eventually exceeds the limit. At this point, we can first use the show tablet 27306172 statement, and then execute the show proc statement in the result to view the status of each copy of the tablet. The versionCount in the result represents the number of versions. If you find that there are too many versions of a copy, you need to reduce the import frequency or stop importing, and observe whether the number of versions drops. If the version number still does not decrease after the import is stopped, you need to go to the corresponding BE node to check the be.INFO log, search for the tablet id and compaction keywords, and check whether the compaction is running normally. For compaction tuning related, you can refer to the ApacheDoris public account article: Doris Best Practice-Compaction Tuning (3) + +The -238 error usually occurs when the amount of imported data in the same batch is too large, which leads to too many Segment files for a certain tablet (the default is 200, which is controlled by the BE parameter `max_segment_num_per_rowset`). At this time, it is recommended to reduce the amount of data imported in one batch, or to appropriately increase the value of the BE configuration parameter to solve the problem. + +### Q8. tablet 110309738 has few replicas: 1, alive backends: [10003] + +This error may occur during query or import operation. It usually means that the copy of the tablet is abnormal. + +At this point, you can first check whether the BE node is down by using the show backends command, such as the isAlive field is false, or LastStartTime is the most recent time (indicating that it has been restarted recently). If the BE is down, you need to go to the node corresponding to the BE and check the be.out log. If the BE is down due to an exception, usually the exception stack will be printed in be.out to help troubleshoot the problem. If there is no error stack in be.out. You can use the linux command dmesg -T to check whether the process is killed by the system because of OOM. + +If no BE node is down, you need to use the show tablet 110309738 statement, and then execute the show proc statement in the result to check the status of each copy of the tablet for further investigation. + +### Q9. disk xxxxx on backend xxx exceed limit usage + +It usually appears in operations such as import and Alter. This error means that the usage of the corresponding disk corresponding to the BE exceeds the threshold (95% by default). At this time, you can use the show backends command first, where MaxDiskUsedPct shows the usage of the disk with the highest usage on the corresponding BE. If If it exceeds 95%, this error will be reported. + +At this time, you need to go to the corresponding BE node to check the usage in the data directory. The trash directory and snapshot directory can be manually cleaned up to free up space. If the data directory occupies a lot, you need to consider deleting some data to free up space. For details, please refer to [Disk Space Management](../administrator-guide/operation/disk-capacity.md). + +### Q10. invalid cluster id: xxxx + +This error may appear in the results of the show backends or show frontends commands. It usually appears in the error message column of a certain FE or BE node. The meaning of this error is that after Master FE sends heartbeat information to this node, the node finds that the cluster id carried in the heartbeat information is different from the cluster id stored locally, so it refuses to respond to the heartbeat. + +Doris' Master FE node will actively send a heartbeat to each FE or BE node, and will carry a cluster_id in the heartbeat information. The cluster_id is the unique cluster ID generated by the Master FE when a cluster is initialized. When the FE or BE receives the heartbeat information for the first time, it will save the cluster_id locally in the form of a file. The FE file is in the image/ directory of the metadata directory, and BE has a cluster_id file in all data directories. After that, every time a node receives a heartbeat, it will compare the content of the local cluster_id with the content in the heartbeat. If it is inconsistent, it will refuse to respond to the heartbeat. + +This mechanism is a node authentication mechanism to prevent receiving wrong heartbeat information from nodes outside the cluster. + +If you need to recover from this error. First, confirm whether all nodes are the correct nodes in the cluster. After that, for the FE node, you can try to modify the cluster_id value in the image/VERSION file in the metadata directory and restart the FE. For BE nodes, you can delete cluster_id files in all data directories and restart BE. + +### Q11. Does Doris support modifying column names? + +Does not support modifying column names. + +Doris supports modifying database names, table names, partition names, materialized view (Rollup) names, and column types, comments, default values, and so on. But unfortunately, currently does not support modifying the column name. + +For some historical reasons, the column names are currently written directly into the data file. When Doris searches, he also finds the corresponding column by the class name. Therefore, modifying column names is not only a simple metadata modification, but also involves data rewriting, which is a very heavy operation. + +We do not rule out the subsequent use of some compatible means to support lightweight column name modification operations. + +### Q12. Does the table of the Unique Key model support the creation of materialized views? + +not support. + +The table of the Unique Key model is a business-friendly table. Because of its unique function of de-duplication according to the primary key, it can easily synchronize business databases with frequent data changes. Therefore, many users will first consider using the Unique Key model when accessing data to Doris. + +Unfortunately, the table of the Unique Key model cannot create a materialized view. The reason is that the nature of the materialized view is to "pre-calculate" the data through pre-calculation, so that the calculated data is directly returned during the query to speed up the query. In the materialized view, the "pre-calculated" data is usually some aggregated indicators, such as summation and count. At this time, if the data changes, such as udpate or delete, because the pre-calculated data has lost the detailed information, it cannot be updated synchronously. For example, a sum of 5 may be 1+4 or 2+3. Because of the loss of detailed information, we cannot distinguish how the sum is calculated, and therefore cannot meet the update requirements. + +### Q13. show backends/frontends Viewed information is incomplete + +After executing certain statements such as `show backends/frontends`, some columns may be incomplete in the results. For example, the disk capacity information cannot be seen in the show backends results. + +This problem usually occurs when there are multiple FEs in the cluster. If users connect to non-Master FE nodes to execute these statements, they will see incomplete information. This is because part of the information only exists in the Master FE node. Such as BE's disk usage information. Therefore, the complete information can be obtained only after the Master FE is directly connected. + +Of course, the user can also execute `set forward_to_master=true;` before executing these statements. After the session variable is set to true, some information viewing statements executed later will be automatically forwarded to the Master FE to obtain the results. In this way, no matter which FE the user is connected to, the complete result can be obtained. + +### Q14. Import data by calling stream load through a Java program. When a batch of data is large, a Broken Pipe error may be reported + +In addition to Broken Pipe, there may be other strange errors. + +This situation usually occurs after opening httpv2. Because httpv2 is an http service implemented using spring boot, and uses tomcat as the default built-in container. But jetty's handling of 307 forwarding seems to have some problems, so the built-in container will be modified to jetty later. In addition, the version of apache http client in the java program needs to use a version later than 4.5.13. In the previous version, there were also some problems with the processing of forwarding. + +So this problem can be solved in two ways: + +1. Turn off httpv2 + + Add enable_http_server_v2=false in fe.conf and restart FE. However, the new UI interface can no longer be used in this way, and some new interfaces based on httpv2 cannot be used later. (Normal import queries are not affected). + +2. Upgrade + + You can upgrade to Doris 0.15 and later versions, this problem has been fixed. + +### Q15. A new disk is added to the node. Why is the data not balanced on the new disk? + +The current balance strategy of Doris is based on nodes. In other words, the cluster load is judged according to the overall load index of the node (the number of shards and the total disk utilization). And migrate data fragments from high-load nodes to low-load nodes. If each node adds a disk, from the perspective of the node as a whole, the load has not changed, so the balancing logic cannot be triggered. + +In addition, Doris currently does not support balanced operations within a single node and between various disks. Therefore, after adding a new disk, the data will not be balanced to the new disk. + +However, when data is migrated between nodes, Doris will consider the disk factor. For example, if a slice is migrated from node A to node B, the disk with lower disk space utilization among node B will be selected first. + +Here we provide 3 ways to solve this problem: + +1. Rebuild the new table + + Create a new table through the create table like statement, and then use insert into select to synchronize the data from the old table to the new table. Because when a new table is created, the data fragments of the new table will be distributed on the new disk, and the data will also be written to the new disk. This method is suitable for situations where the amount of data is small (within tens of GB). + +2. Through the Decommission command + + The decommission command is used to safely decommission a BE node. This command will first migrate the data fragments on the node to other nodes, and then delete the node. As mentioned earlier, when data is migrated, disks with low disk utilization will be given priority, so this method can "force" the data to be migrated to the disks of other nodes. When the data migration is completed, we cancel the decommission operation, so that the data will be rebalanced back to this node. When we perform the above steps for all BE nodes, the data will be evenly distributed on all disks of all nodes. + + Note that before executing the decommission command, execute the following command first to avoid the node being deleted after it is offline. + + `admin set frontend config("drop_backend_after_decommission" = "false");` + +3. Manually migrate data using API + + Doris provides [HTTP API](../administrator-guide/http-actions/tablet-migration-action.md), which allows you to manually specify data fragments on one disk to migrate to another disk. + +### Q16. How to read FE/BE log correctly? + +In many cases, we need to troubleshoot problems through logs. Here is an explanation of the format and viewing method of the FE/BE log. + +1. FE + + FE logs mainly include: + + * fe.log: main log. Including everything except fe.out. + * fe.warn.log: A subset of the main log, which only records WARN and ERROR level logs. + * fe.out: Standard/error output log (stdout and stderr). + * fe.audit.log: Audit log, which records all SQL requests received by this FE. + + A typical FE log is as follows: + + ``` + 2021-09-16 23:13:22,502 INFO (tablet scheduler|43) [BeLoadRebalancer.selectAlternativeTabletsForCluster():85] cluster is balance: default_cluster with medium: HDD. skip + ``` + + * `2021-09-16 23:13:22,502`: log time. + * `INFO: log level, the default is INFO`. + * `(tablet scheduler|43)`: thread name and thread id. Through the thread id, you can view the thread context information and troubleshoot what happened in this thread. + * `BeLoadRebalancer.selectAlternativeTabletsForCluster():85`: class name, method name and code line number. + * `cluster is balance xxx`: log content. + + Normally, we mainly check the fe.log log. Under special circumstances, some logs may be output to fe.out. + +2. BE + + The BE logs mainly include: + + * be.INFO: Main log. This is actually a soft connection, connected to the latest be.INFO.xxxx. + * be.WARNING: A subset of the main log, only logs of WARN and FATAL levels are recorded. This is actually a soft connection, connected to the latest be.WARN.xxxx. + * be.out: standard/error output log (stdout and stderr). + + A typical BE log is as follows: + + ``` + I0916 23:21:22.038795 28087 task_worker_pool.cpp:1594] finish report TASK. master host: 10.10.10.10, port: 9222 + ``` + + * `I0916 23:21:22.038795`: Log level and date and time. The capital letter I means INFO, W means WARN, and F means FATAL. + * `28087`: thread id. Through the thread id, you can view the thread context information and troubleshoot what happened in this thread. + * `task_worker_pool.cpp:1594`: code file and line number. + * `finish report TASK xxx`: log content. + + Normally, we mainly check the be.INFO log. Under special circumstances, such as BE downtime, you need to check be.out. + +### Q17. How to troubleshoot the cause of FE/BE node down? + +1. BE + + The BE process is a C/C++ process, and the process may hang due to some program bugs (memory out of bounds, illegal address access, etc.) or Out Of Memory (OOM). At this point, we can check the cause of the error through the following steps: + + 1. View be.out + + The BE process realizes that when the program exits due to an abnormal condition, it will print the current error stack to be.out (note that it is be.out, not be.INFO or be.WARNING). Through the error stack, you can usually get a rough idea of ​​where the program went wrong. + + Note that if an error stack appears in be.out, it is usually due to a program bug, and ordinary users may not be able to solve it by themselves. Welcome to the WeChat group, github discussion or dev mail group for help, and post the corresponding error stack for quick Troubleshoot the problem. + + 2. dmesg + + If be.out has no stack information, it is likely that OOM was forcibly killed by the system. At this point, you can use the dmesg -T command to view the Linux system log. If a log similar to Memory cgroup out of memory: Kill process 7187 (palo_be) score 1007 or sacrifice child appears at the end, it means that it is caused by OOM. + + There may be many reasons for memory problems, such as large queries, imports, compactions, etc. Doris is also constantly optimizing memory usage. Welcome to the WeChat group, github discussion or dev mailing group for help. + + 3. Check whether there are logs starting with F in be.INFO. + + The log at the beginning of F is the Fatal log. For example, F0916 means the Fatal log on September 16. Fatal logs usually indicate program assertion errors, and assertion errors will directly cause the process to exit (indicating that the program has a bug). Welcome to the WeChat group, github discussion or dev mailing group for help. + + 4. Minidump + + Mindump is a feature added after Doris 0.15. For details, please refer to [Document](../developer-guide/minidump.md). + +2. FE + + FE is a java process, and its robustness depends on the C/C++ program. Usually, the cause of FE hanging may be OOM (Out-of-Memory) or metadata writing failure. These errors usually have an error stack in fe.log or fe.out. You need to investigate further based on the error stack information. + +### Q18. About the configuration of the data directory SSD and HDD. + +Doris supports a BE node to configure multiple storage paths. Normally, it is sufficient to configure one storage path for each disk. At the same time, Doris supports storage media attributes of specified paths, such as SSD or HDD. SSD stands for high-speed storage devices, and HDD stands for low-speed storage devices. + +By specifying the storage medium properties of the path, we can use Doris's hot and cold data partition storage function to store hot data in the SSD at the partition level, and the cold data will be automatically transferred to the HDD. + +It should be noted that Doris does not automatically perceive the actual storage medium type of the disk where the storage path is located. This type needs to be explicitly indicated by the user in the path configuration. For example, the path "/path/to/data1.SSD" means that this path is an SSD storage medium. And "data1.SSD" is the actual directory name. Doris determines the storage medium type based on the ".SSD" suffix behind the directory name, not the actual storage medium type. In other words, the user can specify any path as the SSD storage medium, and Doris only recognizes the directory suffix and will not judge whether the storage medium matches. If you do not write the suffix, the default is HDD. + +In other words, ".HDD" and ".SSD" are only used to identify the "relative" "low speed" and "high speed" of the storage directory, not the actual storage medium type. Therefore, if the storage path on the BE node has no difference in media, there is no need to fill in the suffix. \ No newline at end of file diff --git a/docs/zh-CN/developer-guide/minidump.md b/docs/zh-CN/developer-guide/minidump.md index bb15ee5d4e..df58b073ef 100644 --- a/docs/zh-CN/developer-guide/minidump.md +++ b/docs/zh-CN/developer-guide/minidump.md @@ -62,9 +62,9 @@ Minidump 的生成有两种方式: ``` Minidump created at: /doris/be/Minidump/4f8d4fe5-15f8-40a3-843109b3-d49993f3.dmp -*** Aborted at 1636970042 (unix time) try "date -d @1636970042" if you are using GNU date *** -PC: @ 0x1b184e4 doris::OlapScanNode::scanner_thread() -*** SIGSEGV (@0x0) received by PID 71567 (TID 0x7f173a5df700) from PID 0; stack trace: *** + *** Aborted at 1636970042 (unix time) try "date -d @1636970042" if you are using GNU date *** + PC: @ 0x1b184e4 doris::OlapScanNode::scanner_thread() + *** SIGSEGV (@0x0) received by PID 71567 (TID 0x7f173a5df700) from PID 0; stack trace: *** @ 0x220c992 google::(anonymous namespace)::FailureSignalHandler() @ 0x7f174fb5e1d0 (unknown) @ 0x1b184e4 doris::OlapScanNode::scanner_thread() diff --git a/docs/zh-CN/faq/faq.md b/docs/zh-CN/faq/faq.md new file mode 100644 index 0000000000..d835f082b1 --- /dev/null +++ b/docs/zh-CN/faq/faq.md @@ -0,0 +1,271 @@ +--- +{ + "title": "FAQ", + "language": "zh-CN" +} +--- + + + +# FAQ + +本文档主要用于记录 Doris 使用过程中的常见问题。会不定期更新。 + +### Q1. 使用 Stream Load 访问 FE 的公网地址导入数据,被重定向到内网 IP? + + +当 stream load 的连接目标为FE的http端口时,FE仅会随机选择一台BE节点做http 307 redirect 操作,因此用户的请求实际是发送给FE指派的某一个BE的。而redirect返回的是BE的ip,也即内网IP。所以如果你是通过FE的公网IP发送的请求,很有可能因为redirect到内网地址而无法连接。 + +通常的做法,一种是确保自己能够访问内网IP地址,或者是给所有BE上层假设一个负载均衡,然后直接将 stream load 请求发送到负载均衡器上,由负载均衡将请求透传到BE节点。 + +### Q2. 查询报错:Failed to get scan range, no queryable replica found in tablet: xxxx + +这种情况是因为对应的 tablet 没有找到可以查询的副本,通常原因可能是 BE 宕机、副本缺失等。可以先通过 `show tablet tablet_id` 语句,然后执行后面的 `show proc` 语句,查看这个 tablet 对应的副本信息,检查副本是否完整。同时还可以通过 `show proc "/cluster_balance"` 信息来查询集群内副本调度和修复的进度。 + +关于数据副本管理相关的命令,可以参阅 [数据副本管理](../administrator-guide/operation/tablet-repair-and-balance.md)。 + +### Q3. FE启动失败,fe.log中一直滚动 "wait catalog to be ready. FE type UNKNOWN" + +这种问题通常有两个原因: + +1. 本次FE启动时获取到的本机IP和上次启动不一致,通常是因为没有正确设置 `priority_network` 而导致 FE 启动时匹配到了错误的 IP 地址。需修改 `priority_network` 后重启 FE。 + +2. 集群内多数 Follower FE 节点未启动。比如有 3 个 Follower,只启动了一个。此时需要将另外至少一个 FE 也启动,FE 可选举组方能选举出 Master 已提供服务。 + +如果以上情况都不能解决,可以按照 Doris 官网文档中的[元数据运维文档](../administrator-guide/operation/metadata-operation.md)进行恢复: + +### Q4. 通过 DECOMMISSION 下线BE节点时,为什么总会有部分tablet残留? + +在下线过程中,通过 show backends 查看下线节点的 tabletNum ,会观察到 tabletNum 数量在减少,说明数据分片正在从这个节点迁移走。当数量减到0时,系统会自动删除这个节点。但某些情况下,tabletNum 下降到一定数值后就不变化。这通常可能有以下两种原因: + +1. 这些 tablet 属于刚被删除的表、分区或物化视图。而刚被删除的对象会保留在回收站中。而下线逻辑不会处理这些分片。可以通过修改 FE 的配置参数 catalog_trash_expire_second 来修改对象在回收站中驻留的时间。当对象从回收站中被删除后,这些 tablet就会被处理了。 + +2. 这些 tablet 的迁移任务出现了问题。此时需要通过 show proc "/cluster_balance" 来查看具体任务的错误了。 + +对于以上情况,可以先通过 show proc "/statistic" 查看集群是否还有 unhealthy 的分片,如果为0,则可以直接通过 drop backend 语句删除这个 BE 。否则,还需要具体查看不健康分片的副本情况。 + + +### Q5. priorty_network 应该如何设置? + +priorty_network 是 FE、BE 都有的配置参数。这个参数主要用于帮助系统选择正确的网卡 IP 作为自己的 IP 。建议任何情况下,都显式的设置这个参数,以防止后续机器增加新网卡导致IP选择不正确的问题。 + +priorty_network 的值是 CIDR 格式表示的。分为两部分,第一部分是点分十进制的 IP 地址,第二部分是一个前缀长度。比如 10.168.1.0/8 会匹配所有 10.xx.xx.xx 的IP地址,而 10.168.1.0/16 会匹配所有 10.168.xx.xx 的 IP 地址。 + +之所以使用 CIDR 格式而不是直接指定一个具体 IP,是为了保证所有节点都可以使用统一的配置值。比如有两个节点:10.168.10.1 和 10.168.10.2,则我们可以使用 10.168.10.0/24 来作为 priorty_network 的值。 + +### Q6. FE的Master、Follower、Observer都是什么? + +首先明确一点,FE 只有两种角色:Follower 和 Observer。而 Master 只是一组 Follower 节点中选择出来的一个 FE。Master 可以看成是一种特殊的 Follower。所以当我们被问及一个集群有多少 FE,都是什么角色时,正确的回答当时应该是所有 FE 节点的个数,以及 Follower 角色的个数和 Observer 角色的个数。 + +所有 Follower 角色的 FE 节点会组成一个可选择组,类似 Poxas 一致性协议里的组概念。组内会选举出一个 Follower 作为 Master。当 Master 挂了,会自动选择新的 Follower 作为 Master。而 Observer 不会参与选举,因此 Observer 也不会称为 Master 。 + +一条元数据日志需要在多数 Follower 节点写入成功,才算成功。比如3个 FE ,2个写入成功才可以。这也是为什么 Follower 角色的个数需要是奇数的原因。 + +Observer 角色和这个单词的含义一样,仅仅作为观察者来同步已经成功写入的元数据日志,并且提供元数据读服务。他不会参与多数写的逻辑。 + +通常情况下,可以部署 1 Follower + 2 Observer 或者 3 Follower + N Observer。前者运维简单,几乎不会出现 Follower 之间的一致性协议导致这种复杂错误情况(百度内部集群大多使用这种方式)。后者可以保证元数据写的高可用,如果是高并发查询场景,可以适当增加 Observer。 + +### Q7. tablet writer write failed, tablet_id=27306172, txn_id=28573520, err=-235 or -215 or -238 + +这个错误通常发生在数据导入操作中。新版错误码为 -235,老版本错误码可能是 -215。这个错误的含义是,对应tablet的数据版本超过了最大限制(默认500,由 BE 参数 `max_tablet_version_num` 控制),后续写入将被拒绝。比如问题中这个错误,即表示 27306172 这个tablet的数据版本超过了限制。 + +这个错误通常是因为导入的频率过高,大于后台数据的compaction速度,导致版本堆积并最终超过了限制。此时,我们可以先通过show tablet 27306172 语句,然后执行结果中的 show proc 语句,查看tablet各个副本的情况。结果中的 versionCount即表示版本数量。如果发现某个副本的版本数量过多,则需要降低导入频率或停止导入,并观察版本数是否有下降。如果停止导入后,版本数依然没有下降,则需要去对应的BE节点查看be.INFO日志,搜索tablet id以及 compaction关键词,检查compaction是否正常运行。关于compaction调优相关,可以参阅 ApacheDoris 公众号文章:Doris 最佳实践-Compaction调优(3) + +-238 错误通常出现在同一批导入数据量过大的情况,从而导致某一个 tablet 的 Segment 文件过多(默认是 200,由 BE 参数 `max_segment_num_per_rowset` 控制)。此时建议减少一批次导入的数据量,或者适当提高 BE 配置参数值来解决。 + +### Q8. tablet 110309738 has few replicas: 1, alive backends: [10003] + +这个错误可能发生在查询或者导入操作中。通常意味着对应tablet的副本出现了异常。 + +此时,可以先通过 show backends 命令检查BE节点是否有宕机,如 isAlive 字段为false,或者 LastStartTime 是最近的某个时间(表示最近重启过)。如果BE有宕机,则需要去BE对应的节点,查看be.out日志。如果BE是因为异常原因宕机,通常be.out中会打印异常堆栈,帮助排查问题。如果be.out中没有错误堆栈。则可以通过linux命令dmesg -T 检查是否是因为OOM导致进程被系统kill掉。 + +如果没有BE节点宕机,则需要通过show tablet 110309738 语句,然后执行结果中的 show proc 语句,查看tablet各个副本的情况,进一步排查。 + +### Q9. disk xxxxx on backend xxx exceed limit usage + +通常出现在导入、Alter等操作中。这个错误意味着对应BE的对应磁盘的使用量超过了阈值(默认95%)此时可以先通过 show backends 命令,其中MaxDiskUsedPct展示的是对应BE上,使用率最高的那块磁盘的使用率,如果超过95%,则会报这个错误。 + +此时需要前往对应BE节点,查看数据目录下的使用量情况。其中trash目录和snapshot目录可以手动清理以释放空间。如果是data目录占用较大,则需要考虑删除部分数据以释放空间了。具体可以参阅[磁盘空间管理](../administrator-guide/operation/disk-capacity.md)。 + +### Q10. invalid cluster id: xxxx + +这个错误可能会在show backends 或 show frontends 命令的结果中出现。通常出现在某个FE或BE节点的错误信息列中。这个错误的含义是,Master FE向这个节点发送心跳信息后,该节点发现心跳信息中携带的 cluster id和本地存储的 cluster id不同,所以拒绝回应心跳。 + +Doris的 Master FE 节点会主动发送心跳给各个FE或BE节点,并且在心跳信息中会携带一个cluster_id。cluster_id是在一个集群初始化时,由Master FE生成的唯一集群标识。当FE或BE第一次收到心跳信息后,则会将cluster_id以文件的形式保存在本地。FE的该文件在元数据目录的image/目录下,BE则在所有数据目录下都有一个cluster_id文件。之后,每次节点收到心跳后,都会用本地cluster_id的内容和心跳中的内容作比对,如果不一致,则拒绝响应心跳。 + +该机制是一个节点认证机制,以防止接收到集群外的节点发送来的错误的心跳信息。 + +如果需要恢复这个错误。首先要先确认所有节点是否都是正确的集群中的节点。之后,对于FE节点,可以尝试修改元数据目录下的 image/VERSION 文件中的 cluster_id 值后重启FE。对于BE节点,则可以删除所有数据目录下的 cluster_id 文件后重启 BE。 + +### Q11. Doris 是否支持修改列名? + +不支持修改列名。 + +Doris支持修改数据库名、表名、分区名、物化视图(Rollup)名称,以及列的类型、注释、默认值等等。但遗憾的是,目前不支持修改列名。 + +因为一些历史原因,目前列名称是直接写入到数据文件中的。Doris在查询时,也是通过类名查找到对应的列的。所以修改列名不仅是简单的元数据修改,还会涉及到数据的重写,是一个非常重的操作。 + +我们不排除后续通过一些兼容手段来支持轻量化的列名修改操作。 + +### Q12. Unique Key模型的表是否支持创建物化视图? + +不支持。 + +Unique Key模型的表是一个对业务比较友好的表,因为其特有的按照主键去重的功能,能够很方便的同步数据频繁变更的业务数据库。因此,很多用户在将数据接入到Doris时,会首先考虑使用Unique Key模型。 + +但遗憾的是,Unique Key模型的表是无法建立物化视图的。原因在于,物化视图的本质,是通过预计算来将数据“预先算好”,这样在查询时直接返回已经计算好的数据,来加速查询。在物化视图中,“预计算”的数据通常是一些聚合指标,比如求和、求count。这时,如果数据发生变更,如udpate或delete,因为预计算的数据已经丢失了明细信息,因此无法同步的进行更新。比如一个求和值5,可能是 1+4,也可能是2+3。因为明细信息的丢失,我们无法区分这个求和值是如何计算出来的,因此也就无法满足更新的需求。 + +### Q13. show backends/frontends 查看到的信息不完整 + +在执行如` show backends/frontends` 等某些语句后,结果中可能会发现有部分列内容不全。比如show backends结果中看不到磁盘容量信息等。 + +通常这个问题会出现在集群有多个FE的情况下,如果用户连接到非Master FE节点执行这些语句,就会看到不完整的信息。这是因为,部分信息仅存在于Master FE节点。比如BE的磁盘使用量信息等。所以只有在直连Master FE后,才能获得完整信息。 + +当然,用户也可以在执行这些语句前,先执行 `set forward_to_master=true;` 这个会话变量设置为true后,后续执行的一些信息查看类语句会自动转发到Master FE获取结果。这样,不论用户连接的是哪个FE,都可以获取到完整结果了。 + +### Q14. 通过Java程序调用stream load导入数据,在一批次数据量较大时,可能会报错Broken Pipe + +除了Broken Pipe外,还可能出现一些其他的奇怪的错误。 + +这个情况通常出现在开启httpv2后。因为httpv2是使用spring boot实现的http 服务,并且使用tomcat作为默认内置容器。但是jetty对307转发的处理似乎有些问题,所以后面将内置容器修改为了jetty。此外,在java程序中的 apache http client的版本需要使用4.5.13以后的版本。之前的版本,对转发的处理也存在一些问题。 + +所以这个问题可以有两种解决方式: + +1. 关闭httpv2 + + 在fe.conf中添加 enable_http_server_v2=false后重启FE。但是这样无法再使用新版UI界面,并且之后的一些基于httpv2的新接口也无法使用。(正常的导入查询不受影响)。 + +2. 升级 + + 可以升级到 Doris 0.15 及之后的版本,已修复这个问题。 + +### Q15. 节点新增加了新的磁盘,为什么数据没有均衡到新的磁盘上? + +当前Doris的均衡策略是以节点为单位的。也就是说,是按照节点整体的负载指标(分片数量和总磁盘利用率)来判断集群负载。并且将数据分片从高负载节点迁移到低负载节点。如果每个节点都增加了一块磁盘,则从节点整体角度看,负载并没有改变,所以无法触发均衡逻辑。 + +此外,Doris目前并不支持单个节点内部,各个磁盘间的均衡操作。所以新增磁盘后,不会将数据均衡到新的磁盘。 + +但是,数据在节点之间迁移时,Doris会考虑磁盘的因素。比如一个分片从A节点迁移到B节点,会优先选择B节点中,磁盘空间利用率较低的磁盘。 + +这里我们提供3种方式解决这个问题: + +1. 重建新表 + + 通过create table like 语句建立新表,然后使用 insert into select的方式将数据从老表同步到新表。因为创建新表时,新表的数据分片会分布在新的磁盘中,从而数据也会写入新的磁盘。这种方式适用于数据量较小的情况(几十GB以内)。 + +2. 通过Decommission命令 + + decommission命令用于安全下线一个BE节点。该命令会先将该节点上的数据分片迁移到其他节点,然后在删除该节点。前面说过,在数据迁移时,会优先考虑磁盘利用率低的磁盘,因此该方式可以“强制”让数据迁移到其他节点的磁盘上。当数据迁移完成后,我们在cancel掉这个decommission操作,这样,数据又会重新均衡回这个节点。当我们对所有BE节点都执行一遍上述步骤后,数据将会均匀的分布在所有节点的所有磁盘上。 + + 注意,在执行decommission命令前,先执行以下命令,以避免节点下线完成后被删除。 + + `admin set frontend config("drop_backend_after_decommission" = "false");` + +3. 使用API手动迁移数据 + + Doris提供了[HTTP API](../administrator-guide/http-actions/tablet-migration-action.md),可以手动指定一个磁盘上的数据分片迁移到另一个磁盘上。 + +### Q16. 如何正确阅读 FE/BE 日志? + +很多情况下我们需要通过日志来排查问题。这里说明一下FE/BE日志的格式和查看方式。 + +1. FE + + FE日志主要有: + + * fe.log:主日志。包括除fe.out外的所有内容。 + * fe.warn.log:主日志的子集,仅记录 WARN 和 ERROR 级别的日志。 + * fe.out:标准/错误输出的日志(stdout和stderr)。 + * fe.audit.log:审计日志,记录这个FE接收的所有SQL请求。 + + 一条典型的FE日志如下: + + ``` + 2021-09-16 23:13:22,502 INFO (tablet scheduler|43) [BeLoadRebalancer.selectAlternativeTabletsForCluster():85] cluster is balance: default_cluster with medium: HDD. skip + ``` + + * `2021-09-16 23:13:22,502`:日志时间。 + * `INFO:日志级别,默认是INFO`。 + * `(tablet scheduler|43)`:线程名称和线程id。通过线程id,就可以查看这个线程上下文信息,方面排查这个线程发生的事情。 + * `BeLoadRebalancer.selectAlternativeTabletsForCluster():85`:类名、方法名和代码行号。 + * `cluster is balance xxx`:日志内容。 + + 通常情况下我们主要查看fe.log日志。特殊情况下,有些日志可能输出到了fe.out中。 + +2. BE + + BE日志主要有: + + * be.INFO:主日志。这其实是个软连,连接到最新的一个 be.INFO.xxxx上。 + * be.WARNING:主日志的子集,仅记录 WARN 和 FATAL 级别的日志。这其实是个软连,连接到最新的一个 be.WARN.xxxx上。 + * be.out:标准/错误输出的日志(stdout和stderr)。 + + 一条典型的BE日志如下: + + ``` + I0916 23:21:22.038795 28087 task_worker_pool.cpp:1594] finish report TASK. master host: 10.10.10.10, port: 9222 + ``` + + * `I0916 23:21:22.038795`:日志等级和日期时间。大写字母I表示INFO,W表示WARN,F表示FATAL。 + * `28087`:线程id。通过线程id,就可以查看这个线程上下文信息,方面排查这个线程发生的事情。 + * `task_worker_pool.cpp:1594`:代码文件和行号。 + * `finish report TASK xxx`:日志内容。 + + 通常情况下我们主要查看be.INFO日志。特殊情况下,如BE宕机,则需要查看be.out。 + +### Q17. FE/BE 节点挂了应该如何排查原因? + +1. BE + + BE进程是 C/C++ 进程,可能会因为一些程序Bug(内存越界,非法地址访问等)或 Out Of Memory(OOM)导致进程挂掉。此时我们可以通过以下几个步骤查看错误原因: + + 1. 查看be.out + + BE进程实现了在程序因异常情况退出时,会打印当前的错误堆栈到be.out里(注意是be.out,不是be.INFO或be.WARNING)。通过错误堆栈,通常能够大致获悉程序出错的位置。 + + 注意,如果be.out中出现错误堆栈,通常情况下是因为程序bug,普通用户可能无法自行解决,欢迎前往微信群、github discussion 或dev邮件组寻求帮助,并贴出对应的错误堆栈,以便快速排查问题。 + + 2. dmesg + + 如果be.out没有堆栈信息,则大概率是因为OOM被系统强制kill掉了。此时可以通过dmesg -T 这个命令查看linux系统日志,如果最后出现 Memory cgroup out of memory: Kill process 7187 (palo_be) score 1007 or sacrifice child 类似的日志,则说明是OOM导致的。 + + 内存问题可能有多方面原因,如大查询、导入、compaction等。Doris也在不断优化内存使用。欢迎前往微信群、github discussion 或dev邮件组寻求帮助。 + + 3. 查看be.INFO中是否有F开头的日志。 + + F开头的的日志是 Fatal 日志。如 F0916 ,表示9月16号的Fatal日志。Fatal日志通常表示程序断言错误,断言错误会直接导致进程退出(说明程序出现了Bug)。欢迎前往微信群、github discussion 或dev邮件组寻求帮助。 + + 4. Minidump + + Mindump 是 Doris 0.15 版本之后加入的功能,具体可参阅[文档](../developer-guide/minidump.md)。 + +2. FE + + FE 是 java 进程,健壮程度要由于 C/C++ 程序。通常FE 挂掉的原因可能是 OOM(Out-of-Memory)或者是元数据写入失败。这些错误通常在 fe.log 或者 fe.out 中有错误堆栈。需要根据错误堆栈信息进一步排查。 + +### Q18. 关于数据目录SSD和HDD的配置。 + +Doris支持一个BE节点配置多个存储路径。通常情况下,每块盘配置一个存储路径即可。同时,Doris支持指定路径的存储介质属性,如SSD或HDD。SSD代表高速存储设备,HDD代表低速存储设备。 + +通过指定路径的存储介质属性,我们可以利用Doris的冷热数据分区存储功能,在分区级别将热数据存储在SSD中,而冷数据会自动转移到HDD中。 + +需要注意的是,Doris并不会自动感知存储路径所在磁盘的实际存储介质类型。这个类型需要用户在路径配置中显式的表示。比如路径 "/path/to/data1.SSD" 即表示这个路径是SSD存储介质。而 "data1.SSD" 就是实际的目录名称。Doris是根据目录名称后面的 ".SSD" 后缀来确定存储介质类型的,而不是实际的存储介质类型。也就是说,用户可以指定任意路径为SSD存储介质,而Doris仅识别目录后缀,不会去判断存储介质是否匹配。如果不写后缀,则默认为HDD。 + +换句话说,".HDD" 和 ".SSD" 只是用于标识存储目录“相对”的“低速”和“高速”之分,而并不是标识实际的存储介质类型。所以如果BE节点上的存储路径没有介质区别,则无需填写后缀。 \ No newline at end of file