精华内容
参与话题
问答
  • Mysql元数据导入Apache Atlas

    热门讨论 2020-06-29 10:34:43
    通过Rest API实现Mysql元数据写入Apache Atlas 创建数据源实例 { "entity":{ "typeName":"rdbms_instance", "attributes":{ "qualifiedName":"192.168.2.11@mysql", "name":"192.168.2.11@mysql", "rdbms_type...

    通过Rest API实现Mysql元数据写入Apache Atlas

    请求方式:POST
    请求路径:http://hostname:21000/api/atlas/v2/entity

    创建数据源实例

    {
        "entity":{
            "typeName":"rdbms_instance",
            "attributes":{
                "qualifiedName":"192.168.2.11@mysql",
                "name":"192.168.2.11@mysql",
                "rdbms_type":"MYSQL",
                "platform":"CentOS 7.5",
                "cloudOrOnPrem":"cloud",
                "hostname":"192.168.2.11",
                "port":"3306",
                "protocol":"http",
                "contact_info":"jdbc",
                "comment":"rdbms_instance API insert test",
                "description":"rdbms_instance test",
                "owner":"root"
            }
        }
    }
    
    [root@testkafka-01 bin]# curl -v -u admin:admin -X POST -H "Content-Type:application/json" -d '{"entity":{"typeName":"rdbms_instance","attributes":{"qualifiedName":"192.168.2.11@mysql","name":"192.168.2.11@mysql","rdbms_type":"MYSQL","platform":"CentOS 7.5","cloudOrOnPrem":"cloud","hostname":"192.168.2.11","port":"3306","protocol":"http","contact_info":"jdbc","comment":"rdbms_instance API insert test","description":"rdbms_instance test","owner":"root"}}}' "http://testkafka-01:21000/api/atlas/v2/entity"
    * About to connect() to testkafka-01 port 21000 (#0)
    *   Trying 192.168.2.11...
    * Connected to testkafka-01 (192.168.2.11) port 21000 (#0)
    * Server auth using Basic with user 'admin'
    > POST /api/atlas/v2/entity HTTP/1.1
    > Authorization: Basic YWRtaW46YWRtaW4=
    > User-Agent: curl/7.29.0
    > Host: testkafka-01:21000
    > Accept: */*
    > Content-Type:application/json
    > Content-Length: 363
    > 
    * upload completely sent off: 363 out of 363 bytes
    < HTTP/1.1 200 OK
    < Date: Sun, 28 Jun 2020 16:22:16 GMT
    < Set-Cookie: ATLASSESSIONID=kt4u9zdyhjrb1aa8ierpllgpu;Path=/;HttpOnly
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < X-Frame-Options: DENY
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < Content-Type: application/json; charset=UTF-8
    < X-Content-Type-Options: nosniff
    < Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:; connect-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline';font-src 'self' data:
    < Server: Apache Atlas
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host testkafka-01 left intact
    {"mutatedEntities":{"CREATE":[{"typeName":"rdbms_instance","attributes":{"qualifiedName":"192.168.2.11@mysql"},"guid":"b68383ce-e9f9-4ac8-9731-b70622eb355b"}]},"guidAssignments":{"-420268170623097":"b68383ce-e9f9-4ac8-9731-b70622eb355b"}}
    

    创建数据库实例,并关联数据源实例

    {
        "entity":{
            "typeName":"rdbms_db",
            "attributes":{
                "qualifiedName":"fyb@192.168.2.11@mysql",
                "owner":"root",
                "ownerType":"USER",
                "name":"fyb",
                "emailAddress":"root",
                "createdBy":"root",
                "createTime":"2020-06-28 10:18:46.555Z",
                "updatedBy":"root",
                "updateTime":"2020-06-28 10:18:46.666Z",
                "description":"rdbms_db fyb API input",
                "prodOrOther":"asd",
                "version":0,
                "contact_info":"qwe",
                "instance":{
                    "guid":"b68383ce-e9f9-4ac8-9731-b70622eb355b",
                    "typeName":"rdbms_instance"
                }
            }
        }
    }
    
    [root@testkafka-01 bin]# curl -v -u admin:admin -X POST -H "Content-Type:application/json" -d '{"entity":{"typeName":"rdbms_db","attributes":{"qualifiedName":"fyb@192.168.2.11@mysql","owner":"root","ownerType":"USER","name":"fyb","emailAddress":"root","createdBy":"root","createTime":"2020-06-28 10:18:46.555Z","updatedBy":"root","updateTime":"2020-06-28 10:18:46.666Z","description":"rdbms_db fyb API input","prodOrOther":"asd","version":0,"contact_info":"qwe","instance":{"guid":"b68383ce-e9f9-4ac8-9731-b70622eb355b","typeName":"rdbms_instance"}}}}' "http://testkafka-01:21000/api/atlas/v2/entity"
    * About to connect() to testkafka-01 port 21000 (#0)
    *   Trying 192.168.2.11...
    * Connected to testkafka-01 (192.168.2.11) port 21000 (#0)
    * Server auth using Basic with user 'admin'
    > POST /api/atlas/v2/entity HTTP/1.1
    > Authorization: Basic YWRtaW46YWRtaW4=
    > User-Agent: curl/7.29.0
    > Host: testkafka-01:21000
    > Accept: */*
    > Content-Type:application/json
    > Content-Length: 456
    > 
    * upload completely sent off: 456 out of 456 bytes
    < HTTP/1.1 200 OK
    < Date: Sun, 28 Jun 2020 16:29:28 GMT
    < Set-Cookie: ATLASSESSIONID=1suf3omtstenfk81tc1g98jjp;Path=/;HttpOnly
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < X-Frame-Options: DENY
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < Content-Type: application/json; charset=UTF-8
    < X-Content-Type-Options: nosniff
    < Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:; connect-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline';font-src 'self' data:
    < Server: Apache Atlas
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host testkafka-01 left intact
    {"mutatedEntities":{"UPDATE":[{"typeName":"rdbms_instance","attributes":{"owner":"root","qualifiedName":"192.168.2.11@mysql","name":"192.168.2.11@mysql","description":"rdbms_instance test"},"guid":"b68383ce-e9f9-4ac8-9731-b70622eb355b","status":"ACTIVE","displayText":"192.168.2.11@mysql","classificationNames":[],"meaningNames":[],"meanings":[]}],"CREATE":[{"typeName":"rdbms_db","attributes":{"qualifiedName":"fyb@192.168.2.11@mysql"},"guid":"5972becf-c042-45a8-9156-1f32115f9fe6"}]},"guidAssignments":{"-420268170623100":"5972becf-c042-45a8-9156-1f32115f9fe6"}}
    

    创建表实例

    {
        "entity":{
            "typeName":"rdbms_table",
            "attributes":{
                "qualifiedName":"fyb.haha@192.168.2.11@mysql",
                "createdBy":"root",
                "name":"haha",
                "comment":"rdbms_table API insert test",
                "description":"rdbms_table  手动输入",
                "owner":"root",
                "type":"table",
                "contact_info":"fyb_info",
                "db":{
                    "guid":"5972becf-c042-45a8-9156-1f32115f9fe6",
                    "typeName":"rdbms_db"
                }
            }
        }
    }
    
    [root@testkafka-01 bin]# curl -v -u admin:admin -X POST -H "Content-Type:application/json" -d '{"entity":{"typeName":"rdbms_table","attributes":{"qualifiedName":"fyb.haha@192.168.2.11@mysql","createdBy":"root","name":"haha","comment":"rdbms_table API insert test","description":"rdbms_table  手动输入","owner":"root","type":"table","contact_info":"table_01_info","db":{"guid":"5972becf-c042-45a8-9156-1f32115f9fe6","typeName":"rdbms_db"}}}}' "http://testkafka-01:21000/api/atlas/v2/entity"
    * About to connect() to testkafka-01 port 21000 (#0)
    *   Trying 192.168.2.11...
    * Connected to testkafka-01 (192.168.2.11) port 21000 (#0)
    * Server auth using Basic with user 'admin'
    > POST /api/atlas/v2/entity HTTP/1.1
    > Authorization: Basic YWRtaW46YWRtaW4=
    > User-Agent: curl/7.29.0
    > Host: testkafka-01:21000
    > Accept: */*
    > Content-Type:application/json
    > Content-Length: 349
    > 
    * upload completely sent off: 349 out of 349 bytes
    < HTTP/1.1 200 OK
    < Date: Mon, 29 Jun 2020 01:51:42 GMT
    < Set-Cookie: ATLASSESSIONID=6rhcaqu554wx14ugizdodwu6b;Path=/;HttpOnly
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < X-Frame-Options: DENY
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < Content-Type: application/json; charset=UTF-8
    < X-Content-Type-Options: nosniff
    < Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:; connect-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline';font-src 'self' data:
    < Server: Apache Atlas
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host testkafka-01 left intact
    {"mutatedEntities":{"UPDATE":[{"typeName":"rdbms_db","attributes":{"owner":"root","qualifiedName":"fyb@192.168.2.11@mysql","name":"fyb","description":"rdbms_db fyb API input"},"guid":"5972becf-c042-45a8-9156-1f32115f9fe6","status":"ACTIVE","displayText":"fyb","classificationNames":[],"meaningNames":[],"meanings":[]}],"CREATE":[{"typeName":"rdbms_table","attributes":{"qualifiedName":"fyb.haha@192.168.2.11@mysql"},"guid":"06cccc33-8c39-4889-ae63-feefe0d8249c"}]},"guidAssignments":{"-422563721869641":"06cccc33-8c39-4889-ae63-feefe0d8249c"}}
    

    创建字段实例

    {
        "entity":{
            "typeName":"rdbms_column",
            "attributes":{
                "qualifiedName":"fyb.haha.id@192.168.2.11@mysql",
                "createdBy":"root",
                "name":"id",
                "comment":"rdbms_column API insert test",
                "description":"rdbms_column API insert test",
                "owner":"root",
                "data_type":"string",
                "length":20,
                "default_value":0,
                "isNullable":true,
                "isPrimaryKey":false,
                "contact_info":"id_info",
    			"table":{
    				"guid":"06cccc33-8c39-4889-ae63-feefe0d8249c",
    				"typeName":"rdbms_table"
    			}
            }
        }
    }
    
    [root@testkafka-01 bin]# curl -v -u admin:admin -X POST -H "Content-Type:application/json" -d '{"entity":{"typeName":"rdbms_column","attributes":{"qualifiedName":"fyb.haha.id@192.168.2.11@mysql","createdBy":"root","name":"id","comment":"rdbms_column API insert test","description":"rdbms_column API insert test","owner":"root","data_type":"string","length":20,"default_value":0,"isNullable":true,"isPrimaryKey":false,"contact_info":"id_info","table":{"guid":"06cccc33-8c39-4889-ae63-feefe0d8249c","typeName":"rdbms_table"}}}}' "http://testkafka-01:21000/api/atlas/v2/entity"
    * About to connect() to testkafka-01 port 21000 (#0)
    *   Trying 192.168.2.11...
    * Connected to testkafka-01 (192.168.2.11) port 21000 (#0)
    * Server auth using Basic with user 'admin'
    > POST /api/atlas/v2/entity HTTP/1.1
    > Authorization: Basic YWRtaW46YWRtaW4=
    > User-Agent: curl/7.29.0
    > Host: testkafka-01:21000
    > Accept: */*
    > Content-Type:application/json
    > Content-Length: 430
    > 
    * upload completely sent off: 430 out of 430 bytes
    < HTTP/1.1 200 OK
    < Date: Mon, 29 Jun 2020 01:59:54 GMT
    < Set-Cookie: ATLASSESSIONID=ins06hsestd4qyscoc8f0y9r;Path=/;HttpOnly
    < Expires: Thu, 01 Jan 1970 00:00:00 GMT
    < X-Frame-Options: DENY
    < X-Content-Type-Options: nosniff
    < X-XSS-Protection: 1; mode=block
    < Strict-Transport-Security: max-age=31536000; includeSubDomains
    < Content-Type: application/json; charset=UTF-8
    < X-Content-Type-Options: nosniff
    < Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:; connect-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline';font-src 'self' data:
    < Server: Apache Atlas
    < Transfer-Encoding: chunked
    < 
    * Connection #0 to host testkafka-01 left intact
    {"mutatedEntities":{"UPDATE":[{"typeName":"rdbms_table","attributes":{"owner":"root","createTime":0,"qualifiedName":"fyb.haha@192.168.2.11@mysql","name":"haha","description":"rdbms_table  手动输入"},"guid":"06cccc33-8c39-4889-ae63-feefe0d8249c","status":"ACTIVE","displayText":"haha","classificationNames":[],"meaningNames":[],"meanings":[]}],"CREATE":[{"typeName":"rdbms_column","attributes":{"qualifiedName":"fyb.haha.id@192.168.2.11@mysql"},"guid":"b4d37e2f-6c13-4533-a05c-09c53bdd6452"}]},"guidAssignments":{"-422563721869653":"b4d37e2f-6c13-4533-a05c-09c53bdd6452"}}
    
    展开全文
  • 如何导入Apache mod_xsendfile

    千次阅读 2014-06-13 16:16:07
    概要

    概要

    把mod_xsendfile导入到Apache中

    这样做了之后,Apache的公开的目录下面的任何文件都可能被下载。
    比如:
    Apache的公开目录默认是 
    /var/www/html

    但是相对于mod_xsendfile
    /data/samba/share/xx

    上面的这个目录里面的文件都可以被下载。


    导入的步骤

    事先确认事项

    事先,确认Apache中是否已经导入好了
    [root@cent01 ~]# yum list installed | grep httpd
    httpd.x86_64                             2.2.3-53.el5.centos.3         installed
    system-config-httpd.noarch               5:1.3.3.3-1.el5               installed
    [root@cent01 ~]#

    httpd-devel的安装

    作为mod_xsendfile的前提,事先需要安装http-devel
    (一执行这一步,xsendfile导入的时候就会有error出现)
    [root@cent01 ~]# yum -y install httpd-devel.x86_64
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: ftp.iij.ad.jp
     * extras: ftp.iij.ad.jp
     * updates: ftp.iij.ad.jp
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd-devel.x86_64 0:2.2.22-jason.1 set to be updated
    --> Processing Dependency: httpd = 2.2.22-jason.1 for package: httpd-devel
    --> Processing Dependency: apr-util-devel for package: httpd-devel
    --> Processing Dependency: apr-devel for package: httpd-devel
    --> Running transaction check
    ---> Package apr-devel.x86_64 0:1.4.5-1.jason.1 set to be updated
    --> Processing Dependency: apr = 1.4.5-1.jason.1 for package: apr-devel
    ---> Package apr-util-devel.x86_64 0:1.3.12-1.jason.1 set to be updated
    --> Processing Dependency: apr-util = 1.3.12-1.jason.1 for package: apr-util-devel
    ---> Package httpd.x86_64 0:2.2.22-jason.1 set to be updated
    --> Processing Dependency: apr-util-ldap for package: httpd
    --> Running transaction check
    ---> Package apr.x86_64 0:1.4.5-1.jason.1 set to be updated
    ---> Package apr-util.x86_64 0:1.3.12-1.jason.1 set to be updated
    ---> Package apr-util-ldap.x86_64 0:1.3.12-1.jason.1 set to be updated
    --> Finished Dependency Resolution
    
    
    Dependencies Resolved
    
    
    ====================================================================================================
     Package                 Arch            Version                      Repository               Size
    ====================================================================================================
    Installing:
     httpd-devel             x86_64          2.2.22-jason.1               utterramblings          150 k
    Installing for dependencies:
     apr-devel               x86_64          1.4.5-1.jason.1              utterramblings          181 k
     apr-util-devel          x86_64          1.3.12-1.jason.1             utterramblings           70 k
     apr-util-ldap           x86_64          1.3.12-1.jason.1             utterramblings           20 k
    Updating for dependencies:
     apr                     x86_64          1.4.5-1.jason.1              utterramblings          260 k
     apr-util                x86_64          1.3.12-1.jason.1             utterramblings          201 k
     httpd                   x86_64          2.2.22-jason.1               utterramblings          3.2 M
    
    
    Transaction Summary
    ====================================================================================================
    Install       4 Package(s)
    Upgrade       3 Package(s)
    
    
    Total download size: 4.0 M
    Downloading Packages:
    (1/7): apr-util-ldap-1.3.12-1.jason.1.x86_64.rpm                             |  20 kB     00:00
    (2/7): apr-util-devel-1.3.12-1.jason.1.x86_64.rpm                            |  70 kB     00:00
    (3/7): httpd-devel-2.2.22-jason.1.x86_64.rpm                                 | 150 kB     00:00
    (4/7): apr-devel-1.4.5-1.jason.1.x86_64.rpm                                  | 181 kB     00:01
    (5/7): apr-util-1.3.12-1.jason.1.x86_64.rpm                                  | 201 kB     00:01
    (6/7): apr-1.4.5-1.jason.1.x86_64.rpm                                        | 260 kB     00:01
    (7/7): httpd-2.2.22-jason.1.x86_64.rpm                                       | 3.2 MB     00:07
    ----------------------------------------------------------------------------------------------------
    Total                                                               273 kB/s | 4.0 MB     00:15
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Updating       : apr                                                                         1/10
      Updating       : apr-util                                                                    2/10
      Installing     : apr-devel                                                                   3/10
      Installing     : apr-util-ldap                                                               4/10
      Updating       : httpd                                                                       5/10
    warning: /etc/httpd/conf/httpd.conf created as /etc/httpd/conf/httpd.conf.rpmnew
      Installing     : apr-util-devel                                                              6/10
      Installing     : httpd-devel                                                                 7/10
      Cleanup        : httpd                                                                       8/10
      Cleanup        : apr                                                                         9/10
      Cleanup        : apr-util                                                                   10/10
    
    
    Installed:
      httpd-devel.x86_64 0:2.2.22-jason.1
    
    
    Dependency Installed:
      apr-devel.x86_64 0:1.4.5-1.jason.1               apr-util-devel.x86_64 0:1.3.12-1.jason.1
      apr-util-ldap.x86_64 0:1.3.12-1.jason.1
    
    
    Dependency Updated:
      apr.x86_64 0:1.4.5-1.jason.1  apr-util.x86_64 0:1.3.12-1.jason.1  httpd.x86_64 0:2.2.22-jason.1
    
    
    Complete!
    [root@cent01 ~]#

    确认「httpd-devel.x86」已经被安装

    [root@cent01 ~]# yum list installed | grep httpd
    httpd.x86_64                             2.2.22-jason.1                installed
    httpd-devel.x86_64                       2.2.22-jason.1                installed
    system-config-httpd.noarch               5:1.3.3.3-1.el5               installed
    [root@cent01 ~]#
    

    mod_xsendfile的安装

    x-sendfile的tar包可以从下面知道网站去下载
    https://tn123.org/mod_xsendfile/
    (我使用过的下载命令: wget https://tn123.org/mod_xsendfile/mod_xsendfile-0.12.tar.gz)
    [root@cent01 tmp]# tar zxvf mod_xsendfile-0.12.tar.gz
    mod_xsendfile-0.12/
    mod_xsendfile-0.12/docs/
    mod_xsendfile-0.12/docs/Readme.html
    mod_xsendfile-0.12/mod_xsendfile.c
    [root@cent01 tmp]#
    [root@cent01 tmp]# cd mod_xsendfile-0.12
    [root@cent01 mod_xsendfile-0.12]# ll
    合計 20
    drwxr-xr-x 2 1001 1001  4096 10月 12  2010 docs
    -rw-r--r-- 1 1001 1001 15992 10月 12  2010 mod_xsendfile.c
    [root@cent01 mod_xsendfile-0.12]#
    [root@cent01 mod_xsendfile-0.12]# apxs -cia mod_xsendfile.c
    /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -m64 
    -mtune=generic  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  
    -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_xsendfile.lo mod_xsendfile.c && 
    touch mod_xsendfile.slo
    /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_xsendfile.la  
    -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_xsendfile.lo
    /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' 
    mod_xsendfile.la /usr/lib64/httpd/modules 
    /usr/lib64/apr-1/build/libtool --mode=install cp mod_xsendfile.la /usr/lib64/httpd/modules/
    cp .libs/mod_xsendfile.so /usr/lib64/httpd/modules/mod_xsendfile.so
    cp .libs/mod_xsendfile.lai /usr/lib64/httpd/modules/mod_xsendfile.la
    cp .libs/mod_xsendfile.a /usr/lib64/httpd/modules/mod_xsendfile.a
    chmod 644 /usr/lib64/httpd/modules/mod_xsendfile.a
    ranlib /usr/lib64/httpd/modules/mod_xsendfile.a
    PATH="$PATH:/sbin" ldconfig -n /usr/lib64/httpd/modules
    ----------------------------------------------------------------------
    Libraries have been installed in:
       /usr/lib64/httpd/modules
    
    
    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
         during execution
       - add LIBDIR to the `LD_RUN_PATH' environment variable
         during linking
       - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
       - have your system administrator add LIBDIR to `/etc/ld.so.conf'
    
    
    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
    chmod 755 /usr/lib64/httpd/modules/mod_xsendfile.so
    [activating module `xsendfile' in /etc/httpd/conf/httpd.conf]
    [root@cent01 mod_xsendfile-0.12]#
    

    mod_xsendfile的设定

    在mod_xsendfile中指定可以从经过Apache下载的公开目录
    在httpd的配置目录中做成新的xsendfile.conf的文件
    [root@cent01 mod_xsendfile-0.12]# cd /etc/httpd/conf.d/
    [root@cent01 conf.d]#
    [root@cent01 conf.d]# ll
    合計 16
    -rw-r--r-- 1 root root 392  2月 24 02:29 README
    -rw-r--r-- 1 root root 560  9月  2  2011 php.conf
    -rw-r--r-- 1 root root 566 12月  6  2005 proxy_ajp.conf
    -rw-r--r-- 1 root root 299  9月  9  2004 welcome.conf
    [root@cent01 conf.d]#
    [root@cent01 conf.d]# vi xsendfile.conf

    比如;
    /data/samba/lib
    记载这个目录下面的文件为经由Apache公开情况的设定
    <IfModule mod_xsendfile.c>
        XsendFile on
        XsendFilePath /data/samba/lib
    </IfModule>
    [root@cent01 conf.d]# ll
    合計 20
    -rw-r--r-- 1 root root 392  2月 24 02:29 README
    -rw-r--r-- 1 root root 560  9月  2  2011 php.conf
    -rw-r--r-- 1 root root 566 12月  6  2005 proxy_ajp.conf
    -rw-r--r-- 1 root root 299  9月  9  2004 welcome.conf
    -rw-r--r-- 1 root root  83  6月  5 22:43 xsendfile.conf
    [root@cent01 conf.d]#

    Apache重新启动之后,把xsendfile的配置读进来

    [root@cent01 conf.d]# /sbin/service httpd restart
    httpd を停止中:                                            [  OK  ]
    httpd を起動中:                                            [  OK  ]
    [root@cent01 conf.d]#

    (配置到此就结束了)

    通过Apache来公开文件的方法

    (Php 方法)

    xsendfile导入之后,实际中下载文件的场合下,为了返回以下的header,在Web app中追加下面的变更
    header('X-Sendfile: '.ファイルのパス);
    比如:
    /data/samba/lib/book1.pdf
    被下载的场合,变成下面的
    header('X-Sendfile: /data/samba/lib/book1.pdf');

    (Rails的方法)

    send_file(path, :filename => "/data/samba/lib/book1.pdf", :type => "application/pdf", :disposition => "inline",:x_sendfile =>true)

    参考网址
    http://kowloonet.org/memo/tech/index.php?Apache%20mod_xsendfile%A4%CE%C6%B3%C6%FE
    展开全文
  • 正在学习用shell编程,正好公司需要对apache进行日分析,就试着写了一段1、首先修改apache配置文件中log文件的格式。 LogFormat "%h,%l,%u,%t,/"%r/" %>s %b" common, 将空格分隔改成","分割,便于后面进行字段...
    正在学习用shell编程,正好公司需要对apache进行日分析,就试着写了一段

    1、首先修改apache配置文件中log文件的格式。
      LogFormat "%h,%l,%u,%t,/"%r/" %>s %b" common, 将空格分隔改成","分割,便于后面进行字段切割。

    2、创建apache访问记录表。创建过程在这里就不细说啦

    3、编写脚本。

    awk '{printf $1","$2","$3","$5","$6"/n"}' /usr/local/apache/logs/access_log >> /tmp/apache_visit_log
    mysql  -uroot -pbjdb@/)/)^ /
           -e "use test; /
           drop index host on log; /
           drop index f2 on log; /
           load data infile '/tmp/apache_visit_log' into table log fields terminated by ','; /
           alter table log add index host (host);/
           alter table log add index f2 (f2)"

    4、执行。查看mysql,是否己成功导入apache日志记录
    展开全文
  • Apache Commons https://en.wikipedia.org/wiki/Apache_Commons 右键项目->Properties->Java Build Path->Libraries->Add External JARs...-> 相关的.jar文件 右键项目->Properties-&...

     

    Apache Commons

    https://en.wikipedia.org/wiki/Apache_Commons

     

    右键项目->Properties->Java Build Path->Libraries->Add External JARs...->

    相关的.jar文件

     

     

    右键项目->Properties->Java Build Path->Libraries->Add External JARs...->

    相关的.jar文件

     

     

    转载于:https://www.cnblogs.com/denggelin/p/7218781.html

    展开全文
  • Android怎么重新导入apache包?

    千次阅读 2016-10-12 14:46:47
    Android6.0之后删除了apache包,怎么重新导入? 1、首先要搜索添加如下依赖 2、然后必须要加入 android { useLibrary 'org.apache.http.legacy' }然后再rebuild一下,就导入成功了! 还有一个方法是降低SDK版本!
  • shiro的例子使用的是maven管理的,这文章包含了maven的基础,入手shiro变得很简单了。
  • Hive导入Apache Nginx等日志与分析          将nginx日志导入到hive中的两种方法  1 在hive中建表 CREATE TABLE apachelog (ipaddress STRING,...
  • hive导入apache nginx等日志与分析

    千次阅读 2011-06-28 15:36:00
    将nginx日志导入到hive中的两种方法 1 在hive中建表CREATE TABLE apachelog (ipaddress STRING, identd STRING, user STRING,finishtime STRING,requestline string, returncode INT, size INT,referer string,...
  • Eclipse导入apache-solr-3.6.0源代码

    千次阅读 2012-07-21 01:58:50
    1.  安装ANT 2. 下载 ivy ,并将 ivy-xxxx....在 apache-solr-3.6.0-src 下: ant eclipse 4. Eclipse import project 5. 在 apache-solr-3.6.0-src 下 新建 WebContent目录,作为项目的docBase 复制
  • 1.apache commons Logging:Commons-loggin的目的是为“所有的Java日志实现”提供一个统一的接口,它自身的日志功能平常弱(只有一个简单的SimpleLog?),所以一般不会单独使用它;它的宗旨在于取消各种日志框架实现...
  • 设置不自动倒入: 打开设置 >... Imports① 将 Class count to use import with “" 改为 99 (导入同一个包的类超过这个数值自动变为 * )② 将 Names count to use static import with "” 改为 9...
  • File->Project Structure->Modules->Dependencies->+,然后输入 apache.http 搜索,再添加依赖就OK了
  • ![图片说明](https://img-ask.csdn.net/upload/201602/26/1456481995_359120.png)
  • 在Eclipse中导入commons-logging-1.2.jar文件的步骤如下: 首先到https://commons.apache.org/proper/commons-logging/download_logging.cgi下载commons-logging-1.2的压缩包 将第一步中所下载的压缩包解压,找到...
  • eclipse中使用common logging 点击下载 commons-logging-1.2-bin.zip,解压缩,找到 commons-logging-1.2.jar... 把commons-logging-1.2.jar添加进对应项目的外部jar资源 添加步骤 ...properties,找到Java Build Path ...
  • import java.io.File; import java.io.IOException; import org.apache.commons.io.... * 需要导入commons-io的jar包,下载地址:(选择bin,不是src)  * http://commons.apache.org/proper/
  • 使用apache poi 实现Excel批量导入

    千次阅读 2017-06-25 21:32:24
    前言 做客户模块的时候需要用到Excel的批量导入,而当前使用的较多的是apache下的POI,因为微软公司的Excel表格有两种格式,分别是xls和xlsx(区别是后者使用xml来格式话保存的,压缩的更好),本文以xlsx文件格式为例...
  • poi apache-poi导入实例 导入excel 利用java的apache-poi读取每一行每一列,导入excel数据,两个for循环出来的[ ][ ] 承装数据
  • apache-jmeter文件导入

    2019-01-07 10:37:27
    apache-jmeter测压工具生成的文档,用jmeter导入即可,
  • Apache Sqoop : 导入

    千次阅读 2019-12-05 08:06:48
    Sqoop导入导入工具”导入单个表从RDBMS到HDFS。表中的每一行被视为HDFS的记录。 所有记录都存储为文本文件的文本数据 下面的语法用于将数据导入HDFS。 $ sqoop import (generic-args) (import-args) Sqoop测试表...
  • Apache Druid数据导入

    2020-04-28 15:16:38
    0.17版本,Druid支持多种数据导入方式: UI界面,根据步骤和提示,一步步执行即可 UI界面,提交json格式的task文件 本地curl命令提交json格式的task文件 Druid家目录下,执行自带的post-index-task 个人感觉第一...
  • 利用Apache POI导入Excel。HSSFWorkBook:操作2003版本以前的(包括2003版本),扩展名.xls,该类在org.apache.poi:poi中XSSFWorkBook:操作2007版本以后的(包括2007版本),拓展名.xlsx,该类在org.apache.poi:poi...
  • hive导入 nginx 或 apache 日志

    千次阅读 2014-04-15 12:28:50
    1、创建表 CREATE TABLE nginxlog ( ipaddress STRING, identity STRING, user STRING, time STRING, request STRING, protocol STRING, status STRING, size STRING, referer STRING, ...
  • Apache导入阿里ssl证书

    2018-06-05 15:11:36
    从阿里购买证书后,会给出一个文档,最下方为实例1. 证书文件xxxxxx.pem,包含两...( 1 ) 在Apache的安装目录下创建cert目录,并且将下载的全部文件拷贝到cert目录中。如果申请证书时是自己创建的CSR文件,请将对应的...
  • Apache Sqoop 安装和导入

    千次阅读 2019-12-04 08:38:49
    Sqoop工作机制是将导入或导出命令翻译成mapreduce程序来实现。在翻译出的mapreduce中主要是对inputformat和outputformat进行定制。 Hadoop生态系统包括:HDFS、Hive、Hbase等 RDBMS体系包括:My...
  • 编写导入数据的sql脚本:建表1.drop database if exists sample; 2.create database sample; 3.drop table if exists sample.kylin_cal_dt; 4.create table sample.kylin_cal_dt( cal_dt date comment 'data,pk',age...
  • 导入org.apache.http包

    千次阅读 2018-04-24 16:11:26
    如果你使用的 target sdk是23请在build.gradle加入 ...android{ useLibrary ‘org.apache.http.legacy’ } 原文地址:http://stackoverflow.com/questions/26024908/apache-httpclient-android-gradle ...
  • Linux apache导入SSL证书

    千次阅读 2017-03-13 20:13:58
    自制ssl凭证 大体流程: 先建立一把 private key 预备提供给 SSL 凭证签名要求所用; 2. 最后建立 SSL 凭证 (test certificates)。 建立凭证文件 ...[root@bird certs]
  • 导入到常用的ide,eclipse吧: 准备工作  1. 下载Eclipse:http://scala-ide.org/  2. 从github上下载源码:https://github.com/apache/spark 第一个实验品是Spark-Core项目  1. exist maven ...
  • android studio3 导入org.apache

    千次阅读 2018-10-15 22:19:03
    最近在入门json,在网上copy了一段代码分析发现as不会自动导入这个包,所以简单写一下。 右键项目,选择open module setting 然后点右上角的加号,选library dependency,  在框里输入apache.http 点搜索...

空空如也

1 2 3 4 5 ... 20
收藏数 13,428
精华内容 5,371
关键字:

导入apache