LightDB-x 单机版安装试用

安装步骤

[lightdb@localhost lightdb-x-13.8-23.3-15725-el7.x86_64]$ ./install.sh
Whether to use the graphical user interface (GUI, Make sure DISPLAY is configured, Such as [export DISPLAY=127.0.0.1:0.0])?(Yes or No)
No
Choice a kind of configuration mode!
1: Only install.
2: Install database and Create instance.
3: Developer
Please enter 1 2 or 3(The default is 1):
2
Choice a kind of install mode!

1: Single Mode.
2: High Availability Mode
3: Distributed Mode
Please enter 1, 2 or 3:(The default is 1)
1
Assign a port to the LightDB!
Listen Port(The default port is 5432):
5432
Check system parameters and dependency packages!
========================================= 192.168.226.100 =========================================
NETWORK
name: sem, recommend value: 500,2048000,200,4096, current value: 500,2048000,200,4096, status: OK
name: aio_max_nr, recommend value: 1048576, current value: 1048576, status: OK
name: somaxconn, recommend value: 2000, current value: 2000, status: OK
name: tcp_max_syn_backlog, recommend value: 2000, current value: 2000, status: OK
name: tcp_tw_reuse, recommend value: 1, current value: 1, status: OK
name: tcp_syn_retries, recommend value: 3, current value: 3, status: OK
name: tcp_retries2, recommend value: 5, current value: 5, status: OK
name: tcp_slow_start_after_idle, recommend value: 0, current value: 0, status: OK
PAGE_CACHE
name: dirty_background_ratio, recommend value: 5, current value: 5, status: OK
name: dirty_ratio, recommend value: 40, current value: 40, status: OK
name: dirty_expire_centisecs, recommend value: 500, current value: 500, status: OK
name: dirty_writeback_centisecs, recommend value: 250, current value: 250, status: OK
MEMORY
name: shmmni, recommend value: 4096, current value: 4096, status: OK
name: shmmax, recommend value: 509767680, current value: 509767680, status: OK
name: shmall, recommend value: 124455, current value: 124455, status: OK
name: swappiness, recommend value: 5, current value: 5, status: OK
name: overcommit_memory, recommend value: 2, current value: 2, status: OK
name: overcommit_ratio, recommend value: 75, current value: 75, status: OK
FILE_HANDLER
name: file_max, recommend value: 524288, current value: 524288, status: OK
ULIMIT
name: ulimit_core, recommend value: unlimited, current value: unlimited, status: OK
name: ulimit_nofile, recommend value: 8192, current value: 524288, status: OK
Dependency Package
name: JSON-C-0.11 is existed: yes
name: C-ARES-1 is existed: yes
name: LIBNL3 is existed: yes
name: LIBPCAP-1 is existed: yes
name: LIBZSTD-1 is existed: yes
name: LZ4-1 is existed: yes
name: NCURSES-LIBS-5 is existed: yes
name: READLINE-6 is existed: yes
name: SNAPPY-1 is existed: yes
name: UUID-1.6 is existed: yes
name: LIBICU-50 is existed: yes
Choice a kind of Compatible Type!
1: LightdDB(Compatible with PostgreSQL).
2: ORACLE(Compatible with ORACLE).
3: MYSQL(Compatible with MYSQL).
Please enter 1, 2 or 3:(The default is 1)
2
Choice a kind of LightDB workload!
1: OLTP(On-line Transaction Processing).
2: OLAP(On-Line Analytical Processing).
Please enter 1 or 2:(The default is 1)
1
Specify a path for installing all LightDB software and storing configuration information.
Please enter base location(The default is /usr/local/lightdb):

Base Location: /usr/local/lightdb
Install Location: /usr/local/lightdb/lightdb-x/13.8-23.3
Please enter instance location(The default is /usr/local/lightdb/lightdb-x/13.8-23.3/cluster):

Instance location: /usr/local/lightdb/lightdb-x/13.8-23.3/cluster
Choice whether to enable archive:
1:yes
2:no
Please enter 1 or 2:(The default is 1)
1
Please configure memory(MB) and character set!
Please enter shared_buffers, Default value is (243):

Please enter effective_cache_size, Default value is (680):

Please choice a kind of Character Set.
1. UTF8
2. GBK
3. SQL_ASCII
4. LATIN1
The default choice 1(UTF8)

Please enter LightDB password!
Please enter original password:

Password format is incorrect. The password must contains one letter and one number, special character is optional.  The length is between 6 and 16

Please enter confirm password:

Do you want to deploy immediately?(Yes or No, The default is yes)

[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]100%s
Install Finish

查看后台进程

[lightdb@localhost lightdb-x-13.8-23.3-15725-el7.x86_64]$ ps -ef | grep lightdb
root        715      1  0 08:16 ?        00:00:00 login -- lightdb
lightdb    1291    715  0 08:27 tty1     00:00:01 -bash
root      10708   1003  0 09:41 ?        00:00:00 sshd: lightdb [priv]
root      10712   1003  0 09:41 ?        00:00:00 sshd: lightdb [priv]
lightdb   10714  10708  0 09:41 ?        00:00:00 sshd: lightdb@pts/0
lightdb   10715  10714  0 09:41 pts/0    00:00:00 -bash
lightdb   10736  10712  0 09:41 ?        00:00:00 sshd: lightdb@notty
lightdb   10737  10736  0 09:41 ?        00:00:00 /usr/libexec/openssh/sftp-server
lightdb   11765      1  0 09:45 ?        00:00:00 /usr/local/lightdb/lightdb-x/13.8-23.3/bin/lightdb -D /usr/local/lightdb/lightdb-x/13.8-23.3/cluster/data
lightdb   11768  11765  0 09:45 ?        00:00:00 lightdb: logger
lightdb   11770  11765  0 09:45 ?        00:00:00 lightdb: checkpointer
lightdb   11771  11765  0 09:45 ?        00:00:00 lightdb: background writer
lightdb   11772  11765  0 09:45 ?        00:00:00 lightdb: walwriter
lightdb   11773  11765  0 09:45 ?        00:00:00 lightdb: autovacuum launcher
lightdb   11774  11765  0 09:45 ?        00:00:00 lightdb: archiver
lightdb   11775  11765  0 09:45 ?        00:00:00 lightdb: stats collector
lightdb   11776  11765  0 09:45 ?        00:00:00 lightdb: lt_cron launcher
lightdb   11777  11765  0 09:45 ?        00:00:00 lightdb: logical replication launcher
lightdb   11921  10715  0 09:47 pts/0    00:00:00 ps -ef
lightdb   11922  10715  0 09:47 pts/0    00:00:00 grep --color=auto lightdb

试用Oracle兼容特性

CREATE TABLE IF NOT EXISTS books
(
    id     INT, 
    title  VARCHAR2(100), 
    author VARCHAR2(100),
    price  NUMBER
);

INSERT INTO books VALUES (10, 'The Hobbit', 'J. R. R. Tolkien', 10.0);
INSERT INTO books VALUES (11, 'Winnie-the-Pooh', 'A. A. Milne', 5.0);
INSERT INTO books VALUES (12, 'Peter Pan', 'James Matthew Barrie', 4.0);
INSERT INTO books VALUES (13, 'Charlie and the Chocolate Factory', 'Roald Dahl', 5.0);
INSERT INTO books VALUES (14, 'SThe Jungle Book', 'Rudyard Kipling', 9.0);
INSERT INTO books VALUES (15, 'The Little White Bird', 'James Matthew Barrie', 3.0);

CREATE OR REPLACE PACKAGE mybooks AS
    CURSOR booksinfo IS SELECT * from BOOKS;
    PROCEDURE list_books;
    FUNCTION add_book(title VARCHAR2(100), author VARCHAR2(100), price NUMBER) RETURN bool;
    PROCEDURE remove_book(book_title VARCHAR2(100));
END;
/
CREATE OR REPLACE PACKAGE BODY mybooks AS
    -- declare private variables
    bookinfo    booksinfo%rowtype; 
    books_count INT;

    PROCEDURE list_books AS
    BEGIN
        OPEN booksinfo;
        RAISE INFO 'Book Info:';
        RAISE INFO '';
        LOOP
            FETCH booksinfo into bookinfo;
            EXIT WHEN NOT FOUND;

            RAISE INFO '  Name    = %', bookinfo.title;
            RAISE INFO '  Author  = %', bookinfo.author;
            RAISE INFO '  Price   = %', bookinfo.price;
            RAISE INFO '------------------------------';
        END LOOP;
        RAISE INFO 'Total Books   = %', books_count;
        CLOSE booksinfo;
    END;

    FUNCTION add_book(title VARCHAR2(100), author VARCHAR2(100), price NUMBER) RETURN bool AS
    BEGIN
        INSERT INTO BOOKS VALUES (
            books_count + 1,
            title,
            author,
            price);
        
        books_count := books_count + 1;
        RETURN true;

        EXCEPTION WHEN OTHERS THEN
            RETURN false;
    END;

    PROCEDURE remove_book(book_title VARCHAR2(100)) AS
    BEGIN
        DELETE FROM BOOKS WHERE title = book_title;

        EXCEPTION WHEN OTHERS THEN
            RAISE INFO 'Book % not found', book_title;
    END;

-- initializer block
BEGIN
    books_count := 0;
    SELECT count(*) INTO books_count FROM BOOKS;
END;
/

BEGIN
    mybooks.list_books;
END;
/

DECLARE
    added bool;
BEGIN
    added := mybooks.add_book('The Cat in the Hat', 'Dr. Seuss', 10);
    IF added = TRUE THEN
        RAISE INFO 'new book added';
    END IF;
END;
/

call mybooks.list_books();

DROP PACKAGE BODY mybooks;
DROP PACKAGE mybooks;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值