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

CockroachDB

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

CockroachDBはスケーラビリティ向けに設計されたクラウドネイティブな分散SQLデータベースです。Squidを利用することで、CockroachDBデータベースと統合し、他のdatabase connectorsとのデータ結合も可能です。

CockroachDBデータベースをSquidと統合するには、以下の手順を実行してください:

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

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).

許可されたIPアドレスの追加方法については、Cockroach Labs documentation をご確認ください。

データベースのセキュリティ強化

デフォルトではセキュリティルールが必須となっており、本番環境ではこれらなしにconnectorへのアクセスを許可することは決して避けるべきです。データベースのセキュリティ強化については、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

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