CockroachDB
Squid は CockroachDB データベースに接続し、Squid アプリケーションのデータソースとして利用できます。
CockroachDB は、スケーラビリティのために設計されたクラウドネイティブな分散 SQL データベースです。Squid を使うことで、CockroachDB データベースと統合し、他のデータベースコネクターのデータと join することもできます。
CockroachDB データベースを Squid と統合するには、次の手順を完了してください。
- Squid Console を開き、CockroachDB で使用するアプリケーションを選択します。
- Connectors タブをクリックし、Available connectors をクリックします。
- CockroachDB コネクターを選択します。
- 次の設定情報を入力します。
- Connector ID - 短く、コネクターを識別しやすい ID を選択します。
- Database endpoint - ポート番号を含むデータベースホスト。
- CockroachDB username
- CockroachDB password - 非公開にするため、パスワードは Squid Secrets に保存してください。
- Schema - 接続する schema 名。指定がない場合は、デフォルトの
publicschema が使用されます。 - Database name - 接続するデータベース名。
- SSL configuration(必要な場合)

接続情報を入力したら 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).
許可リスト(allowlist)に IP アドレスを追加する方法については、Cockroach Labs documentation を参照してください。
データベースのセキュリティ保護
デフォルトでは security rules が必須であり、本番環境ではそれらなしにコネクターへのアクセスを許可しないことが重要です。データベースデータの保護については、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 |
Squid で CockroachDB データを扱う方法については、Client SDK documentation を参照してください。