当前位置:网站首页>How can PostgreSQL in k8s export query results and import them to the database on the local windows machine
How can PostgreSQL in k8s export query results and import them to the database on the local windows machine
2022-06-09 13:14:00 【MonkeyKing_ sunyuhua】
Project under development , Need to put k8s Download the data in to the local database , Do some testing .
Get into postgresql, The query
kubectl get po -n infra
kubectl exec -it postgres-0 -n infra -- bash
\c fs_resource_usage


such as : You need to put the front of the above data 10 Strip export
Use postgresql The order of , Save the query results to pod Below directory
COPY(select * from event where resource_type='COMPUTE' ORDER BY created_at desc limit 10) to '/tmp/tmp.csv' with csv header;
Execute the above command , Will be in pod The Great Wall tmp.csv file 
Use kubectl exec The order will pod Copy the file on to windows On the machine .
kubectl exec -n infra postgres-0 -- tar cf - tmp/ | tar xf - -C C:\\Users\\sunyuhua\\tmp

Note appended : There are many commands for copying , Can pass kubectl cp --help see 
边栏推荐
猜你喜欢
随机推荐
【 Redis底层机制解读:linux操作系统文件描述符FD 】
How to do data visualization analysis
[interpretation of redis underlying mechanism: Linux operating system file descriptor FD]
数据库的安装--mysql
ep240--all
【C语言练习——打印整数二进制的奇数位和偶数位】
【IDEA导入Gradle项目,并启动】
Database day-4
Detailed explanation of three value transfer methods between wechat applet pages
AVR与ARM区别以及常用Arduino
【leetcode周赛记录】第294场周赛记录
U8g2 graphics library and STM32 migration (I2C, software and hardware)
C语言栈--链栈
C语言 队列--顺序队列
Flag options of redis command:
数字化转型的七个错误认知
C language -- single cycle linked list
C语言队列--链队列
用JS压缩上传的图片
Differences between const, VaR and let defined variables in JS


![[C language practice - merging two ordered sequences]](/img/9c/30b9440642381e74f21408883780bd.png)






