为什么在每次启动时启动hadoop job需要密码

时间:2015-12-10 14:12:27

标签: hadoop ssh

当我想开始工作时,我使用hadoop,它总是需要我为16个节点中的3个节点提供连接密码,其中13个工作正常 this is the output it stops until i add the password

我尝试将它们复制到主节点,但问题仍然是16个中的3个奴隶??? !!!!

 ssh-copy-id -i $HOME/.ssh/id_rsa.pub hduser@slavei

注意:我在" slavei"意思是奴隶号码。

2 个答案:

答案 0 :(得分:2)

您需要在提示输入密码import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.*; @SuppressWarnings("serial") public class Chat2 extends JPanel { private static final int ROWS = 25; // rows in the chat view JTextArea private static final int COLS = 40; // columns in the chat view JTextArea // and text entry area private static final int ENTRY_ROWS = 4; // rows in the text entry JTextArea private static final int BL_HGAP = 10; // horizontal gap for our // BorderLayout private static final int BL_VGAP = 5; // vertical gap for our BorderLayout private static final int EB_GAP = 15; // gap for empty border that goes // around entire app private static final String TITLE_TEXT = "My Chat Application"; private static final float TITLE_POINTS = 32f; // size of the title jlabel // text private JTextArea chatViewArea = new JTextArea(ROWS, COLS); private JTextArea textEntryArea = new JTextArea(ENTRY_ROWS, COLS); public Chat2() { // label to display the title in bold large text JLabel titleLabel = new JLabel(TITLE_TEXT, SwingConstants.CENTER); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, TITLE_POINTS)); // set up the chat view JTextArea to have word wrap // and to not be focusable chatViewArea.setWrapStyleWord(true); chatViewArea.setLineWrap(true); chatViewArea.setFocusable(false); // add it to a JScrollPane, and give the scrollpane vertical scrollbars JScrollPane viewScrollPane = new JScrollPane(chatViewArea); viewScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // set up the text entry JTextArea textEntryArea.setWrapStyleWord(true); textEntryArea.setLineWrap(true); // key bindings so that control-enter will act as enter and the enter key will "submit" // the user input to the chat window and the chat server // will allow us to use a multilined text entry area if desired instead // of a single lined JTextField setEnterKeyBinding(textEntryArea); JScrollPane entryScrollPane = new JScrollPane(textEntryArea); entryScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // add an empty border around entire application setBorder(BorderFactory.createEmptyBorder(EB_GAP, EB_GAP, EB_GAP, EB_GAP)); // make the main layout a BorderLayout setLayout(new BorderLayout(BL_HGAP, BL_VGAP)); // add our components to the GUI add(titleLabel, BorderLayout.PAGE_START); add(viewScrollPane, BorderLayout.CENTER); add(entryScrollPane, BorderLayout.PAGE_END); } // Again, use key bindings so that control-enter JTextArea will act as enter key // and the enter key will "submit" the user input to the chat window and the chat server. // When ctrl-enter is pushed the Action originally bound to the enter key will be called // and when enter is pushed a new Action, the EnterKeyAction, will be called private void setEnterKeyBinding(JTextArea textArea) { int condition = JComponent.WHEN_FOCUSED; // only for focused entry key InputMap inputMap = textArea.getInputMap(condition); ActionMap actionMap = textArea.getActionMap(); KeyStroke entryKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); KeyStroke ctrlEntryKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.CTRL_DOWN_MASK); // first give ctrl-enter the action held by enter Object entryKey = inputMap.get(entryKeyStroke); Action entryAction = actionMap.get(entryKey); inputMap.put(ctrlEntryKeyStroke, ctrlEntryKeyStroke.toString()); actionMap.put(ctrlEntryKeyStroke.toString(), entryAction); // now give enter key a new Action EnterKeyAction enterKeyAction = new EnterKeyAction(); inputMap.put(entryKeyStroke, entryKeyStroke.toString()); actionMap.put(entryKeyStroke.toString(), enterKeyAction); } public void appendToChatArea(final String text) { if (SwingUtilities.isEventDispatchThread()) { chatViewArea.append(text + "\n"); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { chatViewArea.append(text + "\n"); } }); } } private class EnterKeyAction extends AbstractAction { @Override public void actionPerformed(ActionEvent e) { String text = textEntryArea.getText(); textEntryArea.setText(""); chatViewArea.append("User: " + text + "\n"); // TODO send text to the chat server! } } private static void createAndShowGui() { Chat2 mainPanel = new Chat2(); JFrame frame = new JFrame("My Chat Window"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().add(mainPanel); // pack the JFrame so that it will size itself to its components frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } } chmod 700 ~/.sshchmod 600 ~/.ssh/id_rsa

的节点上运行此命令

.ssh上的权限受到损害,这就是它提示输入密码的原因。

答案 1 :(得分:0)

检查有问题的服务器上的/etc/ssh/sshd_config文件,查找属性 PubkeyAuthentication ,应将其设置为

同时检查 AllowUsers 属性的设置,如果它处于活动状态,请验证hduser是否已添加到允许的用户列表中。

更改配置文件后,您可以重新加载配置文件或重新启动ssh服务器以获得反映的更改。

希望这有帮助。