View Categories

Artifactory 安装 – 存储配置

1. 本地存储配置(可同时应用于 NFS 存储)

1)单点

示例:
存储路径: /var/opt/jfrog/data/filestore    (自定义,请以实际路径替换)
编辑配置文件 $ARTIFACTORY_HOME/var/etc/artifactory/binarystore.xml, 添加以下部分:

<?xml version="1.0" encoding="UTF-8"?>
<config version="1">
    <chain template="file-system"/>
    <provider id="file-system" type="file-system">
        <fileStoreDir>/var/opt/jfrog/data/filestore</fileStoreDir>
    </provider>
</config>

说明:
fileStoreDir: 二进制文件存储目录

2)HA

示例:
存储路径: /var/opt/jfrog/data/filestore    (自定义,请以实际路径替换)
编辑配置文件 $ARTIFACTORY_HOME/var/etc/artifactory/binarystore.xml, 添加以下部分:


<?xml version="1.0" encoding="UTF-8"?>
<config version="2">
    <chain> <!--template="cluster-file-system"-->
        <provider id="cache-fs" type="cache-fs">
            <provider id="sharding-cluster" type="sharding-cluster">
                <sub-provider id="state-aware" type="state-aware"/>
                <dynamic-provider id="remote-fs" type="remote"/>
                </provider>
        </provider>
    </chain>

    <provider id="state-aware" type="state-aware">
        <zone>local</zone>
        <fileStoreDir>/var/opt/jfrog/data/filestore</fileStoreDir>
    </provider>

    <!-- Shard dynamic remote provider configuration -->
    <provider id="remote-fs" type="remote">
        <zone>remote</zone>
    </provider>

    <provider id="sharding-cluster" type="sharding-cluster">
        <readBehavior>crossNetworkStrategy</readBehavior>
        <writeBehavior>crossNetworkStrategy</writeBehavior>
        <redundancy>2</redundancy>
        <lenientLimit>1</lenientLimit>
        <property name="zones" value="local,remote"/>
    </provider>

</config>

说明:
fileStoreDir: 二进制文件存储目录
redundancy: 副本数,默认为 2。如集群 3 个节点,配置为 2,一份二进制文件将随机存储在其中 2 节点。

2. S3 存储配置

1)单点

编辑配置文件 $ARTIFACTORY_HOME/var/etc/artifactory/binarystore.xml, 添加以下部分:

<config version="2">
    <chain>
        <provider id="cache-fs" type="cache-fs">
            <provider id="s3-storage-v3" type="s3-storage-v3"/>
        </provider>
    </chain>
    <provider id="s3-storage-v3" type="s3-storage-v3">
        <endpoint>s3.amazonaws.com</endpoint>
        <bucketName>bucketName</bucketName>
        <path>pathPrefix</path>
        <region>s3Region</region>
        <identity>yourIdentity</identity>
        <credential>yourCredentials</credential>
    </provider>
</config>

常用参数说明:
(以 aws 为例,以下参数可根据实际情况添加或删除)
endpoint: S3 地址
bucketName: 存储桶名称
path: 存储桶下存储路径
identity: 认证信息
credential:认证密码
region: 地域信息,非 aws 可删除此行,如配置其他自定义 S3 存储
useHttp: 使用 http。默认 false,true 为使用 http,false 为使用 https
port: 端口。s3 为非 80 和 443 的自定义端口,可配置,如 8000
enablePathStyleAccess: 路径样式语法。默认 false,非 aws 可能要设置为 true

2)HA

编辑配置文件 $ARTIFACTORY_HOME/var/etc/artifactory/binarystore.xml, 添加以下部分:

<config version="2">
    <chain>
        <provider id="cache-fs" type="cache-fs">
            <provider id="s3-storage-v3" type="s3-storage-v3"/>
        </provider>
    </chain>
    <provider id="s3-storage-v3" type="s3-storage-v3">
        <endpoint>s3.amazonaws.com</endpoint>
        <bucketName>bucketName</bucketName>
        <path>pathPrefix</path>
        <region>s3Region</region>
        <identity>yourIdentity</identity>
        <credential>yourCredentials</credential>
    </provider>
</config>

常用参数说明:
(以 aws 为例,以下参数可根据实际情况添加或删除)
endpoint: S3 地址
bucketName: 存储桶名称
path: 存储桶下存储路径
identity: 认证信息
credential:认证密码
region: 地域信息,非 aws 可删除此行,如配置其他自定义 S3 存储
useHttp: 使用 http。默认 false,true 为使用 http,false 为使用 https
port: 端口。s3 为非 80 和 443 的自定义端口,可配置,如 8000
enablePathStyleAccess: 路径样式语法。默认 false,非 aws 可能要设置为 true