CockroachDB
SquidはCockroachDBデータベースに接続して、Squidアプリケーションのデータソースとして利用することができます。
CockroachDBはスケーラビリティ向けに設計されたクラウドネイティブな分散SQLデータベースです。Squidを利用することで、CockroachDBデータベースと統合し、他のdatabase connectorsとのデータ結合も可能です。
CockroachDBデータベースをSquidと統合するには、以下の手順を実行してください:
- Squid Console を開き、CockroachDBで使用するアプリケーションを選択します。
- Connectors タブをクリックし、次に Available connectors をクリックします。
- CockroachDB connectorを選択します。
- 以下の設定情報を入力します:
- Connector ID - 識別しやすい簡潔なIDを選択してください。
- Database endpoint - ポート番号を含むデータベースのホスト名。
- CockroachDB username
- CockroachDB password - セキュリティを確保するため、パスワードはSquid Secretsに保存してください。
- Schema - 接続するスキーマの名前。指定がない場合はデフォルトの
publicスキーマが使用されます。 - Database name - 接続するデータベースの名前。
- SSL configuration (if needed)

接続情報を入力したら、Test connection をクリックして接続が正しく構成されていることを確認してください。
Squid's IP address
To prevent denial-of-service attacks, brute force password attacks, and other forms of malicious activity, some providers recommend restricting your network to allow access only from specific IP addresses. This procedure is commonly known as allowlisting, and it limits access to your resources by only accepting connections from a specific list of endpoints.
Refer to your resource provider to determine if you need to add Squid's IP addresses to your access list. If allowlisting is required, you can find Squid's IP addresses on the application overview page of the Squid Console (located in the Cloud Provider section).
許可されたIPアドレスの追加方法については、Cockroach Labs documentation をご確認ください。
データベースのセキュリティ強化
デフォルトではセキュリティルールが必須となっており、本番環境ではこれらなしにconnectorへのアクセスを許可することは決して避けるべきです。データベースのセキュリティ強化については、security rules documentation をご覧ください。
データ型のマッピング
以下の表はCockroachDBとSquid間のデータ型のマッピングを示しています:
| Postgresql Type | Squid Type |
|---|---|
| bigint | number |
| bit | string |
| bit varying | string |
| boolean | boolean |
| bytea | string |
| char | string |
| character | string |
| character varying | string |
| cidr | string |
| date | date |
| double precision | number |
| enum | string |
| inet | string |
| integer | integer |
| interval | string |
| json | map or array |
| jsonb | map or array |
| macaddr | string |
| macaddr8 | string |
| mediumint | integer |
| money | number |
| numeric | number |
| real | number |
| smallint | integer |
| text | string |
| time | string |
| time with time zone | string |
| time without time zone | string |
| timestamp | date |
| timestamp with time zone | date |
| timestamp without time zone | date |
| tinyint | integer |
| uuid | string |
| varchar | string |
CockroachDBデータをSquidで扱う方法については、Client SDK documentation をご覧ください。