【LDAP】Openldap导入数据
在安装完openldap之后,默认ldap中是没有数据的,需要管理员进行添加,当然添加的方法也不止一种,这里先介绍第一种方法:从本地系统添加用户到ldap中。
1
2
3
4
5
6
7
8
9
10
11
12
|
[root@ldapsrv01 ~] # ldapsearch -x -b "dc=contoso,dc=com" # extended LDIF # # LDAPv3 # base <dc=contoso,dc=com> with scope subtree # filter: (objectclass=*) # requesting: ALL # # search result search: 2 result: 32 No such object # numResponses: 1 |
这是安装完openldap之后对ldap进行的数据查询的结果。
步骤一:安装migrationtools软件包
从本地系统添加用户到ldap的方法,其实就是先添加用户到本地操作系统中,然后通过pl脚本将这些用户转换为ldap能够识别的ldif文件格式,最后通过ldapadd命令导入到ldap中,从而完成ldap数据的导入,要使用pl脚本将本地用户信息转换为ldif文件格式,首先需要安装一个软件,名字为migrationtools。
1
2
|
yum install migrationtools -y # 直接yum安装即可 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
[root@ldapsrv01 ~] # rpm -ql migrationtools /usr/share/doc/migrationtools-47 /usr/share/doc/migrationtools-47/README /usr/share/doc/migrationtools-47/migration-tools .txt /usr/share/migrationtools /usr/share/migrationtools/migrate_aliases .pl /usr/share/migrationtools/migrate_all_netinfo_offline .sh /usr/share/migrationtools/migrate_all_netinfo_online .sh /usr/share/migrationtools/migrate_all_nis_offline .sh /usr/share/migrationtools/migrate_all_nis_online .sh /usr/share/migrationtools/migrate_all_nisplus_offline .sh /usr/share/migrationtools/migrate_all_nisplus_online .sh /usr/share/migrationtools/migrate_all_offline .sh /usr/share/migrationtools/migrate_all_online .sh /usr/share/migrationtools/migrate_automount .pl /usr/share/migrationtools/migrate_base .pl /usr/share/migrationtools/migrate_common .ph /usr/share/migrationtools/migrate_fstab .pl /usr/share/migrationtools/migrate_group .pl /usr/share/migrationtools/migrate_hosts .pl /usr/share/migrationtools/migrate_netgroup .pl /usr/share/migrationtools/migrate_netgroup_byhost .pl /usr/share/migrationtools/migrate_netgroup_byuser .pl /usr/share/migrationtools/migrate_networks .pl /usr/share/migrationtools/migrate_passwd .pl /usr/share/migrationtools/migrate_profile .pl /usr/share/migrationtools/migrate_protocols .pl /usr/share/migrationtools/migrate_rpc .pl /usr/share/migrationtools/migrate_services .pl /usr/share/migrationtools/migrate_slapd_conf .pl |
使用rpm -ql命令可以看到,该软件安装后在/usr/share/migrationtools/目录下生成了很多脚本文件,有shell也有perl,而我们就是使用其中的perl脚本完成ldap文件的生成。
步骤二:修改migrationtools配置文件
1
2
3
4
5
6
|
cp /usr/share/migrationtools/migrate_common .ph /usr/share/migrationtools/migrate_common .ph.bak #备份一下脚本 sed -i 's/padl.com/contoso.com/g' /usr/share/migrationtools/migrate_common .ph #修改默认的域名padl.com为我的域名,这里为contoso.com,所以只把padl替换为contoso sed -i 's/dc=padl,dc=com/dc=contoso,dc=com/g' /usr/share/migrationtools/migrate_common .ph #还是域名信息的修改 |
修改之后,要确保下面两条的值为服务器真实的域名,如下:
1
2
|
$DEFAULT_MAIL_DOMAIN = "contoso.com" ; $DEFAULT_BASE = "dc=contoso,dc=com" ; |
步骤三:生成base.ldif文件并导入到ldap中
然后首先生成base.ldif文件
1
|
/usr/share/migrationtools/migrate_base .pl > base.ldif |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
[root@ldapsrv01 ~] # cat base.ldif dn: dc =contoso, dc =com dc : contoso objectClass: top objectClass: domain dn: ou=Hosts, dc =contoso, dc =com ou: Hosts objectClass: top objectClass: organizationalUnit dn: ou=Rpc, dc =contoso, dc =com ou: Rpc objectClass: top objectClass: organizationalUnit dn: ou=Services, dc =contoso, dc =com ou: Services objectClass: top objectClass: organizationalUnit dn: nisMapName=netgroup.byuser, dc =contoso, dc =com nismapname: netgroup.byuser objectClass: top objectClass: nisMap dn: ou=Mounts, dc =contoso, dc =com ou: Mounts objectClass: top objectClass: organizationalUnit dn: ou=Networks, dc =contoso, dc =com ou: Networks objectClass: top objectClass: organizationalUnit dn: ou=People, dc =contoso, dc =com ou: People objectClass: top objectClass: organizationalUnit dn: ou=Group, dc =contoso, dc =com ou: Group objectClass: top objectClass: organizationalUnit dn: ou=Netgroup, dc =contoso, dc =com ou: Netgroup objectClass: top objectClass: organizationalUnit dn: ou=Protocols, dc =contoso, dc =com ou: Protocols objectClass: top objectClass: organizationalUnit dn: ou=Aliases, dc =contoso, dc =com ou: Aliases objectClass: top objectClass: organizationalUnit dn: nisMapName=netgroup.byhost, dc =contoso, dc =com nismapname: netgroup.byhost objectClass: top objectClass: nisMap |
但是这其中有很多信息都不是我所需要的,所以可以删除不需要的信息,修改完成之后,如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[root@ldapsrv01 ~] # cat base.ldif dn: dc =contoso, dc =com dc : contoso objectClass: top objectClass: domain dn: ou=People, dc =contoso, dc =com ou: People objectClass: top objectClass: organizationalUnit dn: ou=Group, dc =contoso, dc =com ou: Group objectClass: top objectClass: organizationalUnit dn: cn=tech,ou=group, dc =contoso, dc =com objectClass: posixGroup description: Technology gidNumber: 10001 cn: tech |
现在,把修改好的base.ldif导入到ldap中,通过使用ldapadd命令来完成。
1
2
3
4
5
6
|
[root@ldapsrv01 ~] # ldapadd -x -D "cn=admin,dc=contoso,dc=com" -W -f base.ldif Enter LDAP Password: adding new entry "dc=contoso,dc=com" adding new entry "ou=People,dc=contoso,dc=com" adding new entry "ou=Group,dc=contoso,dc=com" adding new entry "cn=tech,ou=group,dc=contoso,dc=com" |
导入完成之后,我再进行一次简单查询:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
[root@ldapsrv01 ~] # ldapsearch -x -b "dc=contoso,dc=com" # extended LDIF # # LDAPv3 # base <dc=contoso,dc=com> with scope subtree # filter: (objectclass=*) # requesting: ALL # # contoso.com dn: dc =contoso, dc =com dc : contoso objectClass: top objectClass: domain # People, contoso.com dn: ou=People, dc =contoso, dc =com ou: People objectClass: top objectClass: organizationalUnit # Group, contoso.com dn: ou=Group, dc =contoso, dc =com ou: Group objectClass: top objectClass: organizationalUnit # tech, Group, contoso.com dn: cn=tech,ou=Group, dc =contoso, dc =com objectClass: posixGroup description: Technology gidNumber: 10001 cn: tech # search result search: 2 result: 0 Success # numResponses: 5 # numEntries: 4 |
可以看到,ldap中已经存在之前导入的ou和group了,下面准备用户和组的信息的导入。
步骤四:添加本地系统用户
这里我使用一个脚本(这个脚本不是我写的,而且批量生成用户也算是个简单的脚本吧,怪不得RHCE考这个,原来这里能用到啊。)来批量生成几个用户,然后将这些生成的用户导入到ldap中。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
[root@ldapsrv01 ~] # cat addusers.sh #!/bin/bash # Add system user for ldap in {1..5}; do if id user${ldap} &> /dev/null ; then echo "System account already exists" else adduser user${ldap} -u $((10000 + $ldap)) echo user${ldap} | passwd --stdin user${ldap} &> /dev/null echo "user${ldap} system add finish" fi done [root@ldapsrv01 ~] # ./addusers.sh user1 system add finish user2 system add finish user3 system add finish user4 system add finish user5 system add finish [root@ldapsrv01 ~] # id user1 uid=10001(user1) gid=10001(user1) groups =10001(user1) [root@ldapsrv01 ~] # id user2 uid=10002(user2) gid=10002(user2) groups =10002(user2) [root@ldapsrv01 ~] # id user3 uid=10003(user3) gid=10003(user3) groups =10003(user3) [root@ldapsrv01 ~] # id user4 uid=10004(user4) gid=10004(user4) groups =10004(user4) [root@ldapsrv01 ~] # id user5 uid=10005(user5) gid=10005(user5) groups =10005(user5) |
步骤五:生成people.ldif和group.ldif文件
1
2
3
4
5
6
7
|
[root@ldapsrv01 ~] # tail -5 /etc/passwd user1:x:10001:10001:: /home/user1 : /bin/bash user2:x:10002:10002:: /home/user2 : /bin/bash user3:x:10003:10003:: /home/user3 : /bin/bash user4:x:10004:10004:: /home/user4 : /bin/bash user5:x:10005:10005:: /home/user5 : /bin/bash [root@ldapsrv01 ~] # tail -5 /etc/passwd > testuser |
将这5个用户保存到testuser中,稍后会对这5个本地账户生成ladp用户文件。
1
2
3
4
5
6
7
|
[root@ldapsrv01 ~] # tail -5 /etc/group user1:x:10001: user2:x:10002: user3:x:10003: user4:x:10004: user5:x:10005: [root@ldapsrv01 ~] # tail -5 /etc/group > testgroup |
将这5个组保存到testgroup中,同样稍后会用到。
1
2
3
4
|
/usr/share/migrationtools/migrate_passwd .pl testuser people.ldif #根据testuser生成ldap用户数据文件people.ldif /usr/share/migrationtools/migrate_group .pl testgroup group.ldif #根据testgroup生成ldap组的数据文件group.ldif |
注意,这两条命令的执行一定要在testuser/testgroup目录下,否则要加上全路径,不然找不到文件。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
[root@ldapsrv01 ~] # cat people.ldif dn: uid=user1,ou=People, dc =contoso, dc =com uid: user1 cn: user1 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$Zs9mXyPO$QdqHS8nA /vyjUdnSWLIpM4QiaPtsca1WllXu0dWQOgTza2Qr4TcC3sHbAbJsWI0KannwnM .zFFroqxzglFfJT0 shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10001 gidNumber: 10001 homeDirectory: /home/user1 dn: uid=user2,ou=People, dc =contoso, dc =com uid: user2 cn: user2 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$0dHBettP$u4vVTWuVkRN8NGIecG5O7VSnFDCtcQF /623lLY4Ih6RXORfFcRxh9fFdvssYeg6QAw1KY4LKtk .zwzdVXH2rh1 shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10002 gidNumber: 10002 homeDirectory: /home/user2 dn: uid=user3,ou=People, dc =contoso, dc =com uid: user3 cn: user3 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$CXSotuEN$QSo5gJFlsJ6uZhqaK8qDto.5u2WXwvWSV1JqVP9WMOUVhxZXY8I.XMEUojwGGwpSYY1OtY2Sl /J7dzSk1ey6F/ shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10003 gidNumber: 10003 homeDirectory: /home/user3 dn: uid=user4,ou=People, dc =contoso, dc =com uid: user4 cn: user4 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$ycSPE1gY$ofWgCYtRk9s5LnLKnR4FR5ld10wI6riT2u0jA8wytMm07am1NZreNdhEAJb8.erz4HasyhlsGqecBNdfx5x6S0 shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10004 gidNumber: 10004 homeDirectory: /home/user4 dn: uid=user5,ou=People, dc =contoso, dc =com uid: user5 cn: user5 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword: {crypt}$6$xVZ5hNeH$GzlC19E6Tiq /4Y3HmtCwRjjKVzvcI2IA .z.QPqhwHU.mSV1UT7uZiaVG8HelvbgZJsn3Z1te75C /DNZ .C0Ov50 shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10005 gidNumber: 10005 homeDirectory: /home/user5 |
这是生成的people.ldif文件,里面是用户的信息,包括密码等信息,如果某些字段不需要,也可以删除。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
[root@ldapsrv01 ~] # cat group.ldif dn: cn=user1,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user1 userPassword: {crypt}x gidNumber: 10001 dn: cn=user2,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user2 userPassword: {crypt}x gidNumber: 10002 dn: cn=user3,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user3 userPassword: {crypt}x gidNumber: 10003 dn: cn=user4,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user4 userPassword: {crypt}x gidNumber: 10004 dn: cn=user5,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user5 userPassword: {crypt}x gidNumber: 10005 |
这是生成的group.ldif文件,里面是用户组的信息,这里的gidNumber就是在本地操作系统中的gid。
因为我之前已经添加了一个tech的用户组,它的gidNumber是10001,会跟即将导入的user1组的gidNumber冲突,所以我先删除tech用户组。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
[root@ldapsrv01 ~] # ldapdelete -x -D "cn=admin,dc=contoso,dc=com" -W "cn=tech,ou=Group,dc=contoso,dc=com" Enter LDAP Password: [root@ldapsrv01 ~] # ldapsearch -x -b "dc=contoso,dc=com" # extended LDIF # # LDAPv3 # base <dc=contoso,dc=com> with scope subtree # filter: (objectclass=*) # requesting: ALL # # contoso.com dn: dc =contoso, dc =com dc : contoso objectClass: top objectClass: domain # People, contoso.com dn: ou=People, dc =contoso, dc =com ou: People objectClass: top objectClass: organizationalUnit # Group, contoso.com dn: ou=Group, dc =contoso, dc =com ou: Group objectClass: top objectClass: organizationalUnit # search result search: 2 result: 0 Success # numResponses: 4 # numEntries: 3 |
已经没有tech用户组了,可以开始导入用户和用户组了。
步骤六:导入ldif文件到ldap中
1
2
3
4
5
6
7
|
[root@ldapsrv01 ~] # ldapadd -x -D "cn=admin,dc=contoso,dc=com" -W -f people.ldif Enter LDAP Password: adding new entry "uid=user1,ou=People,dc=contoso,dc=com" adding new entry "uid=user2,ou=People,dc=contoso,dc=com" adding new entry "uid=user3,ou=People,dc=contoso,dc=com" adding new entry "uid=user4,ou=People,dc=contoso,dc=com" adding new entry "uid=user5,ou=People,dc=contoso,dc=com" |
导入people.ldif文件,操作成功。
1
2
3
4
5
6
7
|
[root@ldapsrv01 ~] # ldapadd -x -D "cn=admin,dc=contoso,dc=com" -W -f group.ldif Enter LDAP Password: adding new entry "cn=user1,ou=Group,dc=contoso,dc=com" adding new entry "cn=user2,ou=Group,dc=contoso,dc=com" adding new entry "cn=user3,ou=Group,dc=contoso,dc=com" adding new entry "cn=user4,ou=Group,dc=contoso,dc=com" adding new entry "cn=user5,ou=Group,dc=contoso,dc=com" |
导入group.ldif文件,操作成功。
步骤七:搜索ldap用户和组,验证操作是否成功
再对ldap进行一次用户检索:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
[root@ldapsrv01 ~] # ldapsearch -LLL -x -D "cn=admin,dc=contoso,dc=com" -W -b "dc=contoso,dc=com" '(uid=*)' Enter LDAP Password: dn: uid=user1,ou=People, dc =contoso, dc =com uid: user1 cn: user1 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword:: e2NyeXB0fSQ2JFpzOW1YeVBPJFFkcUhTOG5BL3Z5alVkblNXTElwTTRRaWFQdHN jYTFXbGxYdTBkV1FPZ1R6YTJRcjRUY0Mzc0hiQWJKc1dJMEthbm53bk0uekZGcm9xeHpnbEZmSlQw shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10001 gidNumber: 10001 homeDirectory: /home/user1 dn: uid=user2,ou=People, dc =contoso, dc =com uid: user2 cn: user2 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword:: e2NyeXB0fSQ2JDBkSEJldHRQJHU0dlZUV3VWa1JOOE5HSWVjRzVPN1ZTbkZEQ3R jUUYvNjIzbExZNEloNlJYT1JmRmNSeGg5ZkZkdnNzWWVnNlFBdzFLWTRMS3RrLnp3emRWWEgycmgx shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10002 gidNumber: 10002 homeDirectory: /home/user2 dn: uid=user3,ou=People, dc =contoso, dc =com uid: user3 cn: user3 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword:: e2NyeXB0fSQ2JENYU290dUVOJFFTbzVnSkZsc0o2dVpocWFLOHFEdG8uNXUyV1h 3dldTVjFKcVZQOVdNT1VWaHhaWFk4SS5YTUVVb2p3R0d3cFNZWTFPdFkyU2wvSjdkelNrMWV5NkYv shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10003 gidNumber: 10003 homeDirectory: /home/user3 dn: uid=user4,ou=People, dc =contoso, dc =com uid: user4 cn: user4 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword:: e2NyeXB0fSQ2JHljU1BFMWdZJG9mV2dDWXRSazlzNUxuTEtuUjRGUjVsZDEwd0k 2cmlUMnUwakE4d3l0TW0wN2FtMU5acmVOZGhFQUpiOC5lcno0SGFzeWhsc0dxZWNCTmRmeDV4NlMw shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10004 gidNumber: 10004 homeDirectory: /home/user4 dn: uid=user5,ou=People, dc =contoso, dc =com uid: user5 cn: user5 objectClass: account objectClass: posixAccount objectClass: top objectClass: shadowAccount userPassword:: e2NyeXB0fSQ2JHhWWjVoTmVIJEd6bEMxOUU2VGlxLzRZM0htdEN3UmpqS1Z6dmN JMklBLnouUVBxaHdIVS5tU1YxVVQ3dVppYVZHOEhlbHZiZ1pKc24zWjF0ZTc1Qy9ETlouQzBPdjUw shadowLastChange: 17053 shadowMin: 0 shadowMax: 99999 shadowWarning: 7 loginShell: /bin/bash uidNumber: 10005 gidNumber: 10005 homeDirectory: /home/user5 |
对用户组进行数据检索:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
[root@ldapsrv01 ~] # ldapsearch -LLL -x -D "cn=admin,dc=contoso,dc=com" -W -b "dc=contoso,dc=com" '(objectClass=posixGroup)' Enter LDAP Password: dn: cn=user1,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user1 userPassword:: e2NyeXB0fXg= gidNumber: 10001 dn: cn=user2,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user2 userPassword:: e2NyeXB0fXg= gidNumber: 10002 dn: cn=user3,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user3 userPassword:: e2NyeXB0fXg= gidNumber: 10003 dn: cn=user4,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user4 userPassword:: e2NyeXB0fXg= gidNumber: 10004 dn: cn=user5,ou=Group, dc =contoso, dc =com objectClass: posixGroup objectClass: top cn: user5 userPassword:: e2NyeXB0fXg= gidNumber: 10005 |
已经将在本地使用shell脚本批量创建的5个用户(user1--user5)以及对应的5个用户组(user1--user5)都导入到ldap中,从本地系统添加用户到ldap中的操作完成。
【LDAP】Openldap导入数据的更多相关文章
- elasticsearch river 从数据库中导入数据
Elasticsearch中使用reiver-jdbc导入数据 2014-05-13 15:10 本站整理 浏览(3384) Elasticsearch中使用reiver-jdbc导入数据,有 ...
- SQL SERVER导入数据到ORACLE的方法总结
我们偶尔会有将数据从SQL SERVER导入到ORACLE当中的这种需求,那么这种跨数据库导数有那些方法呢?这些方法又有那些利弊呢? 下面比较肤浅的总结了一些可行的方法. 1:生成SQL脚本然后去OR ...
- Elasticsearch —— bulk批量导入数据
在使用Elasticsearch的时候,一定会遇到这种场景--希望批量的导入数据,而不是一条一条的手动导入.那么此时,就一定会需要bulk命令! 更多内容参考我整理的Elk教程 bulk批量导入 批量 ...
- SQL Server导入数据时“启用标示插入”详解
在SQL Server中导入数据时,会有一个"启用标示插入"的选项,突然间懵逼了,这到底啥意思?我选与不选这个选项,结果好像没区别!不科学啊这,"存在即合理", ...
- MySQL 导入数据
MySQL中可以使用两种简单的方式来导入MySQL导出的数据. 使用 LOAD DATA 导入数据 MySQL 中提供了LOAD DATA INFILE语句来插入数据. 以下实例中将从当前目录中读取文 ...
- 导入数据经常使用的SQL语句整理整理
1.事务(基本) GO BEGIN TRY BEGIN TRAN -- 导入数据 COMMIT TRAN END TRY BEGIN CATCH ROLLBACK TRAN END CATCH GO ...
- geotrellis使用(二十一)自动导入数据
目录 前言 整体介绍 前台界面 后台控制 总结 一.前言 之前Geotrellis数据导入集群采用的是命令行的方式,即通过命令行提交spark任务来ingest数据,待数据导入完毕再启动 ...
- 通过SQL Server自定义数据类型实现导入数据
写在前面 在看同事写的代码时看到了SQL Server中可以自定义数据类型,而且定义的是DataTable类型的数据类型. 后我想起了以前我们导入数据时要么是循环insert写入,要么是SqlBulk ...
- 【转】hive导入数据出现NULL
在把hdfs上数据迁移到hive中的表时,若出现数据位NULL,是因为没有指定列分隔符. 由于hive默认的分隔符是/u0001(Ctrl+A),为了平滑迁移,需要在创建表格时指定数据的分割符号,语法 ...
随机推荐
- CentOS 6.7中安装python3.5
1.安装一些依赖的软件包 yum groupinstall "Development tools" yum install zlib-devel bzip2-devel opens ...
- Python3的简单的函数调用
python3的几种传参方法(初学者): 例1: def func(x,*argv): print(x) print(argv) func('alex','wt','hjc','lao liu') 输 ...
- H - the Sum of Cube(水题)
A range is given, the begin and the end are both integers. You should sum the cube of all the intege ...
- findControl 可以获取前台页面的控件
findControl 可以获取前台页面的控件
- 洛谷P3784 [SDOI2017]遗忘的集合(生成函数)
题面 传送门 题解 生成函数这厮到底还有什么是办不到的-- 首先对于一个数\(i\),如果存在的话可以取无限多次,那么它的生成函数为\[\sum_{j=0}^{\infty}x^{ij}={1\ove ...
- oracle修改连接数
使用 sqlplus登陆 sqlplus system 然后切换到sysdba模式 conn ?/ as sysdba 查询当前的processes sessions的大小 show ...
- P2900 [USACO08MAR]土地征用Land Acquisition
\(\color{#0066ff}{ 题目描述 }\) 约翰准备扩大他的农场,眼前他正在考虑购买N块长方形的土地.如果约翰单买一块土 地,价格就是土地的面积.但他可以选择并购一组土地,并购的价格为这些 ...
- 【三支火把】--- 关于BIOS&UEFI查阅资料网站总结
UEFI和BIOS的水太深,网上能找到的资料是那么的少,各个组织之间互有交叉,难弄的很,总结了下常用的BIOS资料网站,仅供参考,如果遗漏之处,请指出,博主将继续完善补充……
- 使用原生js来操作对象dom的class属性
之前一直都使用jquery来操作dom,今天想自己用原生写一些插件,却发现给dom增删class的时候,使用slice来截取className特别的麻烦,后来发现,原来原生JS本来就有提供api来对d ...
- socket 连接关闭的TIME_WAIT状态的理由
MSL就是maximum segment lifetime(最大分节生命期),这是一个IP数据包能在互联网上生存的最长时间,超过这个时间将在网络中消失 TIME_WAIT两点原因: 1.TCP分节可能 ...