iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >扩展segment数量
  • 390
分享到

扩展segment数量

2024-04-02 19:04:59 390人浏览 八月长安
摘要

第一部分 扩展Greenplum segment数量 1. 将主机加入集群(如果在原有主机扩展,不需要这一步) 环境配置,例如OS kernel 参数; 创建gp管理用户; ssh key的交换(使用gps

第一部分 扩展Greenplum segment数量

1. 将主机加入集群(如果在原有主机扩展,不需要这一步)

环境配置,例如OS kernel 参数;
创建gp管理用户;
ssh key的交换(使用gpssh-exkeys -e exist_hosts -x new_hosts);
greenplum bin软件的拷贝;
规划segment 数据目录;
使用gpcheck检查 (gpcheck -f new_hosts );
使用gpcheckperf检查性能 (gpcheckperf -f new_hosts_file -d /data1 -d /data2 -v)

2. 初始化segment并加入集群

这一步主要做的是
产生配置文件(gpexpand -f new_hosts_file),也可以自己写配置文件;
在指定目录初始化segment数据库(gpexpand -i cnf -D dbname );
将新增的segment信息添加到master元表;
扩展失败了怎么处理?

3. 重分布表

规划表的重分布优先级顺序;
将表数据根据新的 segments 重新分布。
分析表;

第二部分 实例演示

1.一种是在集群中的原有机器中添加segment。

1.1 测试环境

4台虚拟机,每台虚拟机16G内存,跑8个segment。
查看配置
test=# select * from gp_segment_configuration ;

1.2 原地扩展8个segment

因为没有新增主机,所以直接进入第二步.
创建需要扩展segment的主机文件
cat > seg_nodes << EOF
gpsegment62
gpsegment63
gpsegment64
EOF

1.3 产生配置文件

$gpexpand -f ./seg_nodes
Would you like to initiate a new System Expansion Yy|Nn (default=N):
> y

How many new primary segments per host do you want to add? (default=0):  每个主机加几个segment
> 8

Enter new primary data directory 1:  segment data目录
> /greenplum/data/gpdatap9
此处中间省略。。。
Enter new primary data directory 8:  segment data目录
> /greenplum/data/gpdatap16
Enter new mirror data directory 1:  segment data目录
> /greenplum/data/gpdatam9
此处中间省略。。。
Enter new mirror data directory 8:  segment data目录
> /greenplum/data/gpdatam16

Input configuration files were written to 'gpexpand_inputfile_20180814_140954' and 'None'.
Please review the file and make sure that it is correct then re-run
with: gpexpand -i gpexpand_inputfile_20180814_140954 -D diGoal

1.4 产生的配置文件内容如下

$cat gpexpand_inputfile_20180814_140954
gpsegment62:gpsegment62:40008:/greenplum/data/gpdatap9/gpseg24:50:24:p:41008
gpsegment63:gpsegment63:50008:/greenplum/data/gpdatam9/gpseg24:82:24:m:51008
gpsegment62:gpsegment62:40009:/greenplum/data/gpdatap10/gpseg25:51:25:p:41009
gpsegment63:gpsegment63:50009:/greenplum/data/gpdatam10/gpseg25:83:25:m:51009
gpsegment62:gpsegment62:40010:/greenplum/data/gpdatap11/gpseg26:52:26:p:41010
gpsegment63:gpsegment63:50010:/greenplum/data/gpdatam11/gpseg26:84:26:m:51010
gpsegment62:gpsegment62:40011:/greenplum/data/gpdatap12/gpseg27:53:27:p:41011
gpsegment63:gpsegment63:50011:/greenplum/data/gpdatam12/gpseg27:85:27:m:51011
gpsegment62:gpsegment62:40012:/greenplum/data/gpdatap13/gpseg28:54:28:p:41012
...
gpsegment62:gpsegment62:50012:/greenplum/data/gpdatam13/gpseg44:78:44:m:51012
gpsegment64:gpsegment64:40013:/greenplum/data/gpdatap14/gpseg45:71:45:p:41013
gpsegment62:gpsegment62:50013:/greenplum/data/gpdatam14/gpseg45:79:45:m:51013
gpsegment64:gpsegment64:40014:/greenplum/data/gpdatap15/gpseg46:72:46:p:41014
gpsegment62:gpsegment62:50014:/greenplum/data/gpdatam15/gpseg46:80:46:m:51014
gpsegment64:gpsegment64:40015:/greenplum/data/gpdatap16/gpseg47:73:47:p:41015
gpsegment62:gpsegment62:50015:/greenplum/data/gpdatam16/gpseg47:81:47:m:51015

内容包括几个字段
hostname           主机名
address            类似主机名
port               segment监听端口
fselocation        segment data目录,注意是全路径
dbid               gp集群的唯一ID,可以到gp_segment_configuration中获得,必须顺序累加
content            可以到gp_segment_configuration中获得,必须顺序累加
prefered_role      角色(p或m)(primary , mirror)
replication_port   如果没有mirror则不需要(用于replication的端口)。
如果你觉得以上内容有问题,可以手工修改。

1.5 创建扩展数据目录

gpssh -f seg_nodes 'mkdir /greenplum/data/gpdatap{9..16} /greenplum/data/gpdatam{9..16}'
修改配置
gpconfig -c max_connections -v 1000 -m 500
gpconfig -c shared_buffers -v 64m -m 64m
gpstop -afr

1.6 执行gpexpand进行扩展

gpexpand -i gpexpand_inputfile_20180814_140954 -D test -V -v -n 8 -B 1 -t /home/gpadmin/gpAdminLogs
解释一下命令
-B <batch_size>
 Batch size of remote commands to send to a given host before 
 making a one-second pause. Default is 16. Valid values are 1-128.
 The gpexpand utility issues a number of setup commands that may exceed 
 the host's maximum threshold for authenticated connections as defined 
 by MaxStartups in the SSH daemon configuration. The one-second pause 
 allows authentications to be completed before gpexpand issues any 
 more commands. The default value does not nORMally need to be changed. 
 However, it may be necessary to reduce the maximum number of commands 
 if gpexpand fails with connection errors such as 
 'ssh_exchange_identification: Connection closed by remote host.'

-D <database_name>
 Specifies the database in which to create the expansion schema 
 and tables. If this option is not given, the setting for the 
 environment variable PGDATABASE is used. The database templates 
 template1 and template0 cannot be used.

-i | --input <input_file>
 Specifies the name of the expansion configuration file, which contains 
 one line for each segment to be added in the format of:

  <hostname>:<address>:<port>:<fselocation>:<dbid>:<content>:<preferred_role>:<replication_port>

-n <parallel_processes>
 The number of tables to Redistribute simultaneously. Valid values 
 are 1 - 16. Each table redistribution process requires two database 
 connections: one to alter the table, and another to update the table's 
 status in the expansion schema. Before increasing -n, check the current 
 value of the server configuration parameter max_connections and make 
 sure the maximum connection limit is not exceeded.

-S | --simple_progress
 Show simple progress view.

-t | --tardir <directory>
 Specify the temporary directory on segment hosts to put tar file.

-v | --verbose
 Verbose debugging output. With this option, the utility will output 
 all DDL and DML used to expand the database.

-V | --novacuum
 Do not vacuum catalog tables before creating schema copy.

1.7 运行成功的输出如下

20180814:14:15:20:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-Transitioning from PREPARE_EXPANSION_SCHEMA_STARTED to PREPARE_EXPANSION_SCHEMA_DONE
20180814:14:15:20:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-Transitioning from PREPARE_EXPANSION_SCHEMA_DONE to EXPANSION_PREPARE_DONE
20180814:14:15:20:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-Removing segment configuration backup file
20180814:14:15:20:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-Stopping Greenplum Database
20180814:14:16:18:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-Starting Greenplum Database
20180814:14:16:36:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-Starting new mirror segment synchronization
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-************************************************
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-Initialization of the system expansion complete.
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-To begin table expansion onto the new segments
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-rerun gpexpand
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-************************************************
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[INFO]:-Exiting...
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-WorkerPool haltWork()
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-[worker0] haltWork
20180814:14:17:48:002788 gpexpand:gpmaster61:gpadmin-[DEBUG]:-[worker0] got a halt cmd

1.8 扩展失败回滚

启动限制模式,回滚。
gpstart -R
gpexpand --rollback -D test
gpstart -a
然后找问题继续上一步,直到成功。

1.9 成功后可以看到节点数变多了

test=# select * from gp_segment_configuration ;

1.10 在数据重分布前,新增的节点对老数据不起作用。

接下来可以计划重分布任务中,表的调度顺序了
digoal=# select * from gpexpand.
gpexpand.status              gpexpand.status_detail       gpexpand.expansion_progress  
digoal=# select * from gpexpand.status;
   status   |          updated
------------+----------------------------
 SETUP      | 2015-12-17 16:50:07.15973
 SETUP DONE | 2015-12-17 16:50:16.427367
(2 rows)
查看接下来的任务,如果要调整任务的先后顺序,改rank即可。
digoal=# select * from gpexpand.status_detail ;
 dbname |   fq_name    | schema_oid | table_oid | distribution_policy | distribution_policy_names | distribution_policy_coloids | storage_options | rank |   status    | expansion_started | expansion_finished | source_bytes 
--------+--------------+------------+-----------+---------------------+---------------------------+-----------------------------+-----------------+------+-------------+-------------------+--------------------+--------------
 digoal | public.test  |       2200 |     17156 | {1}                 | id                        | 17156                       |                 |    2 | NOT STARTED |                   |                    |            0
 digoal | public.test1 |       2200 |     17182 | {1}                 | id                        | 17182                       |                 |    2 | NOT STARTED |                   |                    |            0
(2 rows)
例如:
=> UPDATE gpexpand.status_detail SET rank=10;
=> UPDATE gpexpand.status_detail SET rank=1 WHERE fq_name = 'public.lineitem';
=> UPDATE gpexpand.status_detail SET rank=2 WHERE fq_name = 'public.orders';
These commands lower the priority of all tables to 10 and then assign a rank of 1 to lineitem and a rank of 2 to orders. 
When table redistribution begins, lineitem is redistributed first, followed by orders and all other tables in gpexpand.status_detail. 
To exclude a table from redistribution, remove the table from gpexpand.status_detail.

还有多少个表未完成重分布
digoal=# select * from gpexpand.expansion_progress ;
name | value
-------------+-------
Tables Left | 2
(1 row)

2.11 执行重分布命令。

需要指定计划在多久内完成,或者计划在哪天完成重分布,脚本会自动调度重分布。
gpexpand -a -d 1:00:00 -D test -S -t /tmp -v -n 1

命令解释
To begin the redistribution phase, you must run gpexpand with either 
the -d (duration) or -e (end time) options. Until the specified end 
time or duration is reached, the utility will redistribute tables in 
the expansion schema. Each table is reorganized using ALTER TABLE 
commands to rebalance the tables across new segments, and to set 
tables to their original distribution policy. If gpexpand completes 
the reorganization of all tables before the specified duration, 
it displays a success message and ends. 

NOTE: Data redistribution should be performed during low-use hours. 
Redistribution can divided into batches over an extended period. 

-a | --analyze
 Run ANALYZE to update the table statistics after expansion. 
 The default is to not run ANALYZE.

-d | --duration <hh:mm:ss>
 Duration of the expansion session from beginning to end.

-D <database_name>
 Specifies the database in which to create the expansion schema 
 and tables. If this option is not given, the setting for the 
 environment variable PGDATABASE is used. The database templates 
 template1 and template0 cannot be used.

-e | --end '<YYYY-MM-DD hh:mm:ss>'
 Ending date and time for the expansion session.

-S | --simple_progress
 Show simple progress view.

-t | --tardir <directory>
 Specify the temporary directory on segment hosts to put tar file.

-v | --verbose
 Verbose debugging output. With this option, the utility will output 
 all DDL and DML used to expand the database.

-n <parallel_processes>
 The number of tables to redistribute simultaneously. Valid values 
 are 1 - 16. Each table redistribution process requires two database 
 connections: one to alter the table, and another to update the table's 
 status in the expansion schema. Before increasing -n, check the current 
 value of the server configuration parameter max_connections and make 
 sure the maximum connection limit is not exceeded.

重分布过程中,可以看到进度。
digoal=# select * from gpexpand.expansion_progress ;
      name       | value
-----------------+-------
 Tables Expanded | 1
 Tables Left     | 1
(2 rows)

test=# select * from gpexpand.status_detail ;
 dbname |   fq_name    | schema_oid | table_oid | distribution_policy | distribution_policy_names | distribution_policy_coloids | storage_options | rank |   status    |     expansion_started     |     expansion_finished     | source_byte
s 
--------+--------------+------------+-----------+---------------------+---------------------------+-------
--
test | public.test  |  2200 | 17156 | {1}       | id     | 17156    |    |  2 | NOT STARTED |      |    |0
test | public.test1 |  2200 | 17182 | {1}       | id     | 17182    |    |  2 | COMPLETED   | 2015-12-17 17:12:12.43088 | 2015-12-17 17:13:27.335207 | 0
(2 rows)

# 或者在命令行看进度

20151217:17:12:11:020043 gpexpand:digoal193096:digoal-[DEBUG]:-['digoal', 'public.test1', 2200L, 17182L, '{1}', 'id', '17182', None, 2, 'NOT STARTED', None, None, Decimal('0')]
20151217:17:12:11:020043 gpexpand:digoal193096:digoal-[DEBUG]:-Adding cmd to work_queue: None
20151217:17:12:11:020043 gpexpand:digoal193096:digoal-[DEBUG]:-['digoal', 'public.test', 2200L, 17156L, '{1}', 'id', '17156', None, 2, 'NOT STARTED', None, None, Decimal('0')]
20151217:17:12:11:020043 gpexpand:digoal193096:digoal-[DEBUG]:-Adding cmd to work_queue: None
20151217:17:12:11:020043 gpexpand:digoal193096:digoal-[DEBUG]:-woke up.  queue: 2 finished 0  
。。。。
20151217:17:14:36:020043 gpexpand:digoal193096:digoal-[DEBUG]:-woke up.  queue: 2 finished 1  
20151217:17:14:40:020043 gpexpand:digoal193096:digoal-[INFO]:-Analyzing public.test
20151217:17:14:41:020043 gpexpand:digoal193096:digoal-[DEBUG]:-woke up.  queue: 2 finished 1  
20151217:17:14:43:020043 gpexpand:digoal193096:digoal-[INFO]:-Finished expanding digoal.public.test
20151217:17:14:43:020043 gpexpand:digoal193096:digoal-[DEBUG]:-UPDATE gpexpand.status_detail
                  SET status = 'COMPLETED', expansion_started='2015-12-17 17:13:29.258085', expansion_finished='2015-12-17 17:14:43.552232'
                  WHERE dbname = 'digoal' AND schema_oid = 2200
                  AND table_oid = 17156 
20151217:17:14:44:020043 gpexpand:digoal193096:digoal-[DEBUG]:-[worker0] finished cmd: name cmdStr='None'
20151217:17:14:46:020043 gpexpand:digoal193096:digoal-[DEBUG]:-WorkerPool haltWork()
20151217:17:14:46:020043 gpexpand:digoal193096:digoal-[DEBUG]:-[worker0] haltWork
。。。
20151217:17:14:54:020043 gpexpand:digoal193096:digoal-[INFO]:-EXPANSION COMPLETED SUCCESSFULLY
20151217:17:14:54:020043 gpexpand:digoal193096:digoal-[INFO]:-Exiting...

2.12 最后一步操作,清除重分布产生的schema gpexpand

gpexpand -c -D test

问你是否需要在清除gpexpand schema前将状态信息导出。
Do you want to dump the gpexpand.status_detail table to file? Yy|Nn (default=Y):
> y

2. 另一种是新增主机,添加segment

例子2,再扩展,6个segment,并且新加一台主机。达到每个主机分布4个SEGMENT的目的。
和例子1的差别就在于新加了主机,所以需要额外的过程。

过程概要
环境配置,例如OS kernel 参数;
创建gp管理用户;
ssh key的交换(使用gpssh-exkeys -e exist_hosts -x new_hosts);
greenplum bin软件的拷贝;
规划segment 数据目录;
使用gpcheck检查 (gpcheck -f new_hosts );
使用gpcheckperf检查性能 (gpcheckperf -f new_hosts_file -d /data1 -d /data2 -v)

2.1 新增主机的操作如下

yum -y install rsync coreutils glib2 lrzsz sysstat e4fsprogs xfsprogs ntp readline-devel zlib zlib-devel openssl openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel GCc make smartmontools flex bison perl perl-devel perl-ExtUtils* OpenIPMI-tools openldap openldap-devel logrotate

cat  > /etc/sysctl.conf << EOF
kernel.shmmax = 68719476736
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 50100 64128000 50100 1280
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
fs.file-max = 7672460
net.ipv4.netfilter.ip_conntrack_max = 655360
fs.aio-max-nr = 1048576
net.ipv4.tcp_keepalive_time = 72
net.ipv4.tcp_keepalive_probes = 9
net.ipv4.tcp_keepalive_intvl = 7
EOF

sysctl -p

cat >> /etc/security/limits.conf EOF
* soft nofile 131072
* hard nofile 131072
* soft nproc 131072
* hard nproc 131072
* soft    memlock unlimited
* hard    memlock unlimited
EOF

rm -f /etc/security/limits.d/90-nproc.conf

2.2 把所有主机的IP和主机名列到/etc/hosts中。使用真实的主机名。(需要在所有节点执行)

cat > /etc/hosts << EOF
127.0.0.1 localhost
192.168.61.61 node61
192.168.61.62 node62
192.168.61.63 node63
192.168.61.64 node64
192.168.61.65 node65
192.168.61.66 node66
192.168.61.67 node67
EOF

2.3 文件系统挂载选项

noatime,nodiratime,nobarrier,discard,nodelalloc,data=writeback

2.4 设置块设备预读

/sbin/blockdev --setra 16384 /dev/xvda1

创建一个管理greenplum 的用户,这里使用digoal
创建一个目录,放gp软件, 给greenplum管理用户写权限,也可以直接使用用户的HOME目录,例如/home/digoal/greenplum-db-4.3.6.1
创建一个目录,放数据库, 给greenplum管理用户写权限
# mkdir -p /data01/gpdata
# chown -R digoal /data01/gpdata
# chmod -R 700 /data01/gpdata

2.5 以下在主节点执行

创建主机文件,包括所有节点以及主节点本身
$ vi host_exist
digoal193096.zmf
digoal199092.zmf
digoal200164.zmf
digoal204016.zmf
digoal204063.zmf

$ vi host_new
digoal209198.zmf

交换KEY,master使用gp管理用户(digoal)访问所有的segment不需要输入密码,master pub拷贝到所有的segment authorized_keys
$ gpssh-exkeys -e host_exist -x host_new

安装软件到segment hosts
$gpseginstall -f ./host_new -u digoal

使用gpcheck检查 
$ gpcheck -f host_new

使用gpcheckperf检查性能 
$ gpcheckperf -f host_new -d /data01/gpdata -v

接下来的操作和前面就差不多了,如下:
$vi host
digoal204016.zmf
digoal204063.zmf
digoal209198.zmf

产生配置文件
$gpexpand -f ./host -c

产生的配置文件内容如下
$cat gpexpand_inputfile_20151217_173855
digoal209198.zmf:digoal209198.zmf:40000:/data01/gpdata/gpseg20:22:20:p
digoal209198.zmf:digoal209198.zmf:40001:/data01/gpdata/gpseg21:23:21:p
digoal209198.zmf:digoal209198.zmf:40002:/data01/gpdata/gpseg22:24:22:p
digoal209198.zmf:digoal209198.zmf:40003:/data01/gpdata/gpseg23:25:23:p
digoal193096.zmf:digoal193096.zmf:40004:/data01/gpdata/gpseg24:26:24:p
digoal199092.zmf:digoal199092.zmf:40004:/data01/gpdata/gpseg25:27:25:p
digoal200164.zmf:digoal200164.zmf:40004:/data01/gpdata/gpseg26:28:26:p
digoal204016.zmf:digoal204016.zmf:40004:/data01/gpdata/gpseg27:29:27:p
digoal204063.zmf:digoal204063.zmf:40004:/data01/gpdata/gpseg28:30:28:p
digoal209198.zmf:digoal209198.zmf:40004:/data01/gpdata/gpseg29:31:29:p

需要人为调整一下: (dbid, contendid都务必连续, 通过查看gp_segment_configuration) (同一主机,端口不能冲突)
digoal204016.zmf:digoal204016.zmf:40004:/data01/gpdata/gpseg20:22:20:p
digoal204063.zmf:digoal204063.zmf:40004:/data01/gpdata/gpseg21:23:21:p
digoal209198.zmf:digoal209198.zmf:40000:/data01/gpdata/gpseg22:24:22:p
digoal209198.zmf:digoal209198.zmf:40001:/data01/gpdata/gpseg23:25:23:p
digoal209198.zmf:digoal209198.zmf:40002:/data01/gpdata/gpseg24:26:24:p
digoal209198.zmf:digoal209198.zmf:40003:/data01/gpdata/gpseg25:27:25:p

接下来需要修改greenplum bin目录权限,gpexpand需要在这个目录写一些东西。
chmod -R 700 /opt/gpdb

2.6 执行gpexpand进行扩展

$ gpexpand -i ./gpexpand_inputfile_20151217_173855 -D digoal -S -V -v -n 1 -B 1 -t /tmp

执行重分布命令。需要指定计划在多久内完成,或者计划在哪天完成重分布,脚本会自动调度重分布。
$ gpexpand -a -d 1:00:00 -D digoal -S -t /tmp -v -n 1
您可能感兴趣的文档:

--结束END--

本文标题: 扩展segment数量

本文链接: https://www.lsjlt.com/news/50561.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • 扩展segment数量
    第一部分 扩展Greenplum segment数量 1. 将主机加入集群(如果在原有主机扩展,不需要这一步) 环境配置,例如OS kernel 参数; 创建gp管理用户; ssh key的交换(使用gps...
    99+
    2024-04-02
  • 【Kotlin】扩展函数 ① ( 扩展函数简介 | 为 Any 超类定义扩展函数 | private 私有扩展函数 | 泛型扩展函数 | 标准函数 let 函数是泛型扩展函数 )
    文章目录 一、扩展函数简介二、为 Any 超类定义扩展函数三、private 私有扩展函数四、泛型扩展函数五、标准函数 let 函数是泛型扩展函数 一、扩展函数简介 为 现有类...
    99+
    2023-09-01
    kotlin 扩展函数 泛型扩展函数 私有扩展函数 Any扩展函数
  • kotlin扩展函数
    一. 概念 Kotlin的扩展函数是一种特殊的函数,允许在不修改原始类定义的情况下向现有类添加新的函数。 扩展函数可以像普通函数一样使用,并且可以在任何地方调用。定义一个扩展函数,可以使用以下语法: ...
    99+
    2023-09-23
    kotlin android
  • Aurora数据库怎么扩展和缩减容量
    Aurora数据库的扩展和缩减容量可以通过以下步骤实现: 扩展容量: 在管理控制台或者通过AWS CLI,找到您的Aurora数...
    99+
    2024-04-09
    Aurora
  • 如何在Kotlin中定义变量与扩展函数
    如何在Kotlin中定义变量与扩展函数?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。Kotlin定义变量kotlin 里的变量定义有两种,val 和 var,其...
    99+
    2023-05-31
    kotlin 定义变量 函数扩展
  • PHP 函数如何扩展?
    php 提供了一种函数扩展机制,允许开发人员创建自定义函数。具体步骤包括:使用 function 关键字创建自定义函数。使用 function_exists() 检查函数是否存在,若不存...
    99+
    2024-04-18
    php 扩展
  • python扩展
    补充一些有趣的知识   1. sys模块方法的补充,打印进度条 import sys,time for i in range(20): sys.stdout.write("#") sys.stdout.flush() ...
    99+
    2023-01-31
    python
  • PHP 框架可扩展性考量:构建高度可扩展的应用程序
    php 框架可扩展性由以下因素影响:架构设计:采用分层架构和模块化设计,分解应用程序组件。组件松耦合:通过接口或事件松散耦合组件,避免硬编码依赖性。缓存机制:利用缓存技术存储经常访问的数...
    99+
    2024-05-04
    php 可扩展性 laravel 数据访问 高可扩展性
  • PHP 函数版本兼容性与扩展扩展是否相关?
    php 函数版本兼容性受 php 扩展影响。扩展是预编译的代码库,可添加或修改函数。扩展版本更新可能导致与旧版本不兼容,例如参数列表更改。解决兼容性问题的方法包括:检查已安装扩展版本、安...
    99+
    2024-04-25
    php 兼容性 mysql
  • mybatis-plus扩展批量新增的实现
    目录前言一、MP如何扩展批量新增方法?二、实现步骤1.扩展批插类2.编写sql注入器3.spring容器中实例化sql注入器总结前言 最近发现公司的微服务项目中没有统一的批量新增方法...
    99+
    2023-01-09
    mybatis-plus 批量新增 mybatis-plus 新增
  • es6数组扩展的方法
    本篇内容介绍了“es6数组扩展的方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!1.扩展运算符含义: 扩展运算符,三个点(...),将一个...
    99+
    2023-06-04
  • Linq扩展函数有哪些
    这篇文章主要为大家展示了“Linq扩展函数有哪些”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Linq扩展函数有哪些”这篇文章吧。首先介绍Linq扩展函数(泛型函数)的方式提供的函数:◆用不同方...
    99+
    2023-06-17
  • PHP扩展入门 我的第一个扩展
    虽说现在的PHP功能已经非常完善,一般情况下不需要我们自己手动扩展就已经可以完全支持我们的使用。但是,我觉得掌握扩展PHP这门技术对于我们以后的发展应该是很有帮助的。 下面我就带大家开始扩展PHP。...
    99+
    2024-02-27
  • 面向初学者的PHP扩展教程:用PHP扩展扩展PHP功能
    PHP扩展是指通过自定义PHP扩展库来扩展PHP的功能,主要目的是满足程序在不同场景下的需求。本文将通过一系列编码案例,对PHP扩展的编写进行讲解,实现定制化功能的需求。 扩展的类型 PHP扩展库有多种类型,其中最常见的是: 函数扩展库...
    99+
    2024-02-11
    PHP 扩展库 扩展功能
  • PHP扩展开发:如何自定义函数与其他扩展交互?
    非常抱歉,由于您没有提供文章标题,我无法为您生成一篇高质量的文章。请您提供文章标题,我将尽快为您生成一篇优质的文章。...
    99+
    2024-05-15
  • python之扩展
    17.2 非常简单的途径:Jython 和 IronPython 一个简单的java类public class JythonTest{ public void greeting(){ System.out.println("Hello,wo...
    99+
    2023-01-31
    python
  • PHP zip 扩展
    Zip 扩展是文件处理中最重要的项目之一。如果你想压缩文件或通过一个文件移动多个文件,则需要 ZIP。 我们需要安装 libzip 来执行涉及其他平台的 ZIP 扩展的操作。 在 Ubuntu...
    99+
    2024-02-27
  • PHP8---MySQL扩展
    目录 一、MySQL扩展的介绍 二、PHP和MySQL连接的基本操作 (1)MySQL连接的准备工作          (2)插入删除操作 三、查询操作 (1)mysqli_fetch_assoc (2)mysqli_fetch_row (...
    99+
    2023-09-15
    mysql php 数据库
  • 在phpstudy中安装php扩展,如apcu扩展等
    【APC是什么】 Alternative PHP Cache (APC)是一种对PHP有效的开放源高速缓冲储存器工具,他能够缓存opcode的php中间码。 【如何安装APC】 下载适合你php版本的...
    99+
    2023-09-10
    php apache 开发语言
  • 怎么使用PostgreSQL扩展函数
    这篇文章主要讲解了“怎么使用PostgreSQL扩展函数”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么使用PostgreSQL扩展函数”吧!例子.&nb...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作