这个问题通常发生在使用GNU并行时,并行的终端中出现交互式命令。解决方法是将并行命令的输出重定向到文件,以避免交互式输入和输出干扰并行进程。
以下是重定向输出的示例代码:
parallel -j0 "beeline -u jdbc:hive2://localhost:10000 -n username -p password -e 'show tables;' > output_{}.txt" ::: 1 2 3
上述命令将通过beeline连接Hive,并在三个终端上同时运行“show tables”命令。输出结果将存储在output_1.txt、output_2.txt和output_3.txt文件中。由于输出被重定向到文件中,这个问题不再发生。