<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Postgres on 村边的池塘</title>
		<link>https://jerrywang1981.github.io/tags/postgres/</link>
		<description>Recent content in Postgres on 村边的池塘</description>
		<generator>Hugo</generator>
		<language>zh-CN</language>
		
		
		
		
			<lastBuildDate>Fri, 11 Sep 2020 15:14:50 +0800</lastBuildDate>
		
			<atom:link href="https://jerrywang1981.github.io/tags/postgres/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Postgres 备份与恢复</title>
				<link>https://jerrywang1981.github.io/post/db/postgres-backup-and-restore/</link>
				<pubDate>Fri, 11 Sep 2020 15:14:50 +0800</pubDate>
				<guid>https://jerrywang1981.github.io/post/db/postgres-backup-and-restore/</guid>
				<description>&lt;h2 id=&#34;背景&#34;&gt;背景&lt;/h2&gt;&#xA;&lt;p&gt;有时候我们需要备份 schema或者包括数据，然后恢复到另外一个postgres db中。&lt;/p&gt;&#xA;&lt;h2 id=&#34;备份&#34;&gt;备份&lt;/h2&gt;&#xA;&lt;p&gt;可以使用 &lt;code&gt;pg_dump&lt;/code&gt; 来备份，或者加上 &amp;ndash;schema-only 只备份schema.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pg_dump --file &amp;#34;/root/repo/uat-copy.tar&amp;#34; --host &amp;#34;db host name&amp;#34; --port &amp;#34;23123&amp;#34; --username &amp;#34;admin&amp;#34; --password --verbose --format=t --blobs --schema-only &amp;#34;compose&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;恢复&#34;&gt;恢复&lt;/h2&gt;&#xA;&lt;p&gt;同样的，可以使用&lt;code&gt;pg_restore&lt;/code&gt;来恢复&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;pg_restore --host &amp;#34;hostname here&amp;#34; --port &amp;#34;31090&amp;#34; --username &amp;#34;usernamehere&amp;#34; --password --dbname &amp;#34;ibmclouddb&amp;#34; --verbose &amp;#34;/root/repo/uat-copy.tar&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;不管备份还是恢复，都会要求输入密码。&lt;/p&gt;</description>
			</item>
			<item>
				<title>Go Gorm 操作数据库</title>
				<link>https://jerrywang1981.github.io/post/go/go-gorm/</link>
				<pubDate>Thu, 23 Jul 2020 08:25:59 +0800</pubDate>
				<guid>https://jerrywang1981.github.io/post/go/go-gorm/</guid>
				<description>&lt;h2 id=&#34;gogorm-操作-postgres&#34;&gt;Go/Gorm 操作 Postgres&lt;/h2&gt;&#xA;&lt;p&gt;虽然go提供了database/sql包来操作数据库，但是如果有个ORM的包，可以直接操作model来操作数据库，就像node里面的sequelize,是不是&#xA;也是挺好的。Gorm就实现了这个功能，这个包目前是github上star数最多的go orm包，包括中文资料，对小伙伴们是相当友好了。&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
