メインコンテンツまでスキップ

CockroachDB

Squid は CockroachDB データベースに接続し、Squid アプリケーションのデータソースとして利用できます。

CockroachDB は、スケーラビリティのために設計されたクラウドネイティブな分散 SQL データベースです。Squid を使うことで、CockroachDB データベースと統合し、他のデータベースコネクターのデータと join することもできます。

CockroachDB データベースを Squid と統合するには、次の手順を完了してください。

  1. Squid Console を開き、CockroachDB で使用するアプリケーションを選択します。
  2. Connectors タブをクリックし、Available connectors をクリックします。
  3. CockroachDB コネクターを選択します。
  4. 次の設定情報を入力します。
  • Connector ID - 短く、コネクターを識別しやすい ID を選択します。
  • Database endpoint - ポート番号を含むデータベースホスト。
  • CockroachDB username
  • CockroachDB password - 非公開にするため、パスワードは Squid Secrets に保存してください。
  • Schema - 接続する schema 名。指定がない場合は、デフォルトの public schema が使用されます。
  • Database name - 接続するデータベース名。
  • SSL configuration(必要な場合)

CockroachDB connector

接続情報を入力したら 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 TypeSquid Type
bigintnumber
bitstring
bit varyingstring
booleanboolean
byteastring
charstring
characterstring
character varyingstring
cidrstring
datedate
double precisionnumber
enumstring
inetstring
integerinteger
intervalstring
jsonmap or array
jsonbmap or array
macaddrstring
macaddr8string
mediumintinteger
moneynumber
numericnumber
realnumber
smallintinteger
textstring
timestring
time with time zonestring
time without time zonestring
timestampdate
timestamp with time zonedate
timestamp without time zonedate
tinyintinteger
uuidstring
varcharstring

Squid で CockroachDB データを扱う方法については、Client SDK documentation を参照してください。